Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deprecated-packages/statie-tweet-publisher
[DEPREATED] Intergated directly in Statie 5.3+
https://github.com/deprecated-packages/statie-tweet-publisher
automated-tweeting php plugin statie twitter
Last synced: about 1 month ago
JSON representation
[DEPREATED] Intergated directly in Statie 5.3+
- Host: GitHub
- URL: https://github.com/deprecated-packages/statie-tweet-publisher
- Owner: deprecated-packages
- Created: 2018-04-11T12:12:48.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-09T15:56:00.000Z (about 6 years ago)
- Last Synced: 2024-11-29T08:41:50.047Z (2 months ago)
- Topics: automated-tweeting, php, plugin, statie, twitter
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [DEPREATED] Intergated directly in Statie 5.3+
Let Statie & Travis publish Tweets for your new posts fo you.
## Install
```bash
composer require tomasvotruba/statie-tweet-publisher:@dev --dev
```## Configure
```yaml
# statie.yml
imports:
- { resource: 'vendor/tomasvotruba/statie-tweet-publisher/src/config/config.yml' }parameters:
twitter_name: 'VotrubaT'
source_directory: '%kernel.project_dir%/../../../source'
# set 0 for testing
minimal_gap_in_days: 1 # how many days to wait before publishing another Tweet
```### Get Twitter Tokens
- Go to [https://apps.twitter.com/app/new](https://apps.twitter.com/app/new)
- Login under account you want to publish in and create new Application
- Then go to "Keys and Access Tokens"
- In the bottom click to "Create my access token"**Now the secret part, be careful about your keys!**
- Add `config/config.local.yml` to `.gitignore`
- Copy these 4 hashes you see in the page to `config/config.local.yml````yaml
# config/config.local.yml
parameters:
# for tomasvotruba/statie-tweet-publisher package locally
twitter_consumer_key: "..."
twitter_consumer_secret: "..."
twitter_oauth_access_token: "..."
twitter_oauth_access_token_secret: "..."
```- Import this file in `statie.yml` **under the package config**, so it has bigger priority and you can test it locally
```yaml
# statie.yml
imports:
- { resource: 'vendor/tomasvotruba/statie-tweet-publisher/src/config/config.yml' }
# enabled on localhost only
- { resource: 'config/config.local.yml', ignore_errors: true }
```- Add `tweet: "some tweet"` to headline of your post to test it
- Run `vendor/bin/publish-new-tweet` and check your Twitter accountIs it there? Good, it works and only few steps remain to fully automate this :)
### Setup Travis Online
Now we only put that logic on Travis and we're done.
- Open Travis for your repository, e.g. [https://travis-ci.org/TomasVotruba/tomasvotruba.cz](https://travis-ci.org/TomasVotruba/tomasvotruba.cz)
- Got to *More options* => *Settings*
- In *Environment Variables* add 4 variables with they values. They are hidden by default, so don't worry:
- `TWITTER_CONSUMER_KEY`
- `TWITTER_CONSUMER_SECRET`
- `TWITTER_OAUTH_ACCESS_TOKEN`
- `TWITTER_OAUTH_ACCESS_TOKEN_SECRET`
- Then setup cron, so posts are being published even if you don't write and have a break.
- Go to *Cron Jobs* → `master` branch → *Daily* → *Always run* → AddThat its!
- And let `.travis.yml` know, that he should publish it
```yaml
# .travis.yml
language: phpmatrix:
include:
- php: 7.1
env: TWEET=1script:
# tweets posts
- if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" && $TWEET != "" ]]; then vendor/bin/publish-new-tweet; fi
```Now you can [quit Twitter](https://www.tomasvotruba.cz/blog/2017/01/20/4-emotional-reasons-why-I-quit-my-twitter/) if you want and you posts will be still there :)