mingalevme / twapponator
TWitter APPlication ONly authenticATOR
Installs: 1 696
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-12-08 02:07:00 UTC
README
Weclcome
Twapponator - Very simple PHP Twitter Application Only Authentication Client.
Travis CI
Codecov
Installing via Composer
The recomended way to install Twapponator is through Composer.
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add Twapponator as a dependency
php composer.phar require mingalevme/twapponator
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
Dependencies
"php": ">=5.3.0"
"ext-curl": "*"
Basic Usage
Once installed you can easily access all of the Twitter API endpoints supported by Application Only Authentication. You can view those enpoints here.
<?php // Obtain Bearer Token (if needed) $token = \Twapponator\Twapponator::obtainBearerToken('consumer_key', 'consumer_secret'); // Now you can cache it for future use $someCacheStorage->set('twitter_bearer_token', $token); // Init Twapponator Object $twapponator = new \Twapponator\Twapponator($token); // Request API Endpoint data try { $data = $twapponator->request('https://api.twitter.com/1.1/statuses/show.json?id=' . $someTweetId); } catch (\Twapponator\Exception $e) { echo $e->getMessage(); exit(); } // For some endpoints there are shortcuts. // See list of available shortcuts in \Twapponator\Client class source code. // Next row is equal to $twapponator->request('https://api.twitter.com/1.1/statuses/show.json?id=' . $someTweetId); $data = $twapponator->status($someTweetId); echo $response;
Unit Testing
Coming Soon