Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/93digital/twitter-api
A PHP class to facilitate Twitter API access, specifically fetching tweets from a single user. Intended for use within WordPress.
https://github.com/93digital/twitter-api
php twitter twitter-api wordpress
Last synced: 3 days ago
JSON representation
A PHP class to facilitate Twitter API access, specifically fetching tweets from a single user. Intended for use within WordPress.
- Host: GitHub
- URL: https://github.com/93digital/twitter-api
- Owner: 93digital
- License: mit
- Created: 2021-07-29T14:26:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-23T16:46:13.000Z (about 3 years ago)
- Last Synced: 2024-11-22T10:15:37.055Z (2 months ago)
- Topics: php, twitter, twitter-api, wordpress
- Language: PHP
- Homepage: https://93digital.co.uk/
- Size: 11.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Twitter Class
Twitter API library which retreives a limited amount of tweets,
answers and retweets from a given user twitter account.The data retreived is stored in **wp_options** as a serializez
string data.Data is updated every **5 minutes** but the time the data is updated
can be changed. It is not recommended to set update data to 0 because
Twitter has restrictions about API abusive call rates.This is a static class therefore does not have to be instantiated.
User Twitter APP data can be set in Admin menu -> Appaerance -> Theme settings.
## How to use
- In extras.php add the following line of code :
```php
```- Log in into your project's **admin panel**. Then open **Appareance -> Theme settings** in the lef menu.
- Open the **Twitter API** tab. Fill the form with the client Twitter APP data. In
order to **get all the tokens** and consumer key you need to make the class work
you will need to create a Twitter APP using the client Twitter account.- You can also set the **Number of Tweets** you want to retrieve and how ofter the
**cache is cleared**. Twitter API has a limit in the number of request you can perform
per day.- Default number of Tweets retrieved per request is **5**.
- Save the form.
- Call static method **return_html** to get an ul HTML element which
contains all the Twitter data. This method accpets parameters. Check
usage_example.php for further information.
```php
$twitter_data = Twitter::return_html();
echo $twitter_data;
?>
```
- Call static method **check_twitter_data()** to retrieve an object
which contains the twitter data.
```php
```
- Modify the attribute **$minutes_after_call** in method **check_retrieve_form_api()**
to change the time passed since last API call.
- Modify the attribute **$request** key *count* in method **return_tweet** to change
the number of tweets retreived
Check file **usage_example.php** located in this repository for a full working example.