Weclcome
Twapponator - Very simple PHP Twitter Application Only Authentication Client., (*1)
Travis CI
, (*2)
Codecov
, (*3)
Installing via Composer
The recomended way to install Twapponator is through Composer., (*4)
# 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:, (*5)
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., (*6)
<?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, (*7)