|
1 |
| -# php-twitter-client |
| 1 | +# Twitter API Client for PHP 7 |
| 2 | + |
| 3 | +[](https://travis-ci.org/php-api-clients/twitter) |
| 4 | +[](https://packagist.org/packages/api-clients/twitter) |
| 5 | +[](https://packagist.org/packages/api-clients/twitter) |
| 6 | +[](https://scrutinizer-ci.com/g/php-api-clients/twitter/?branch=master) |
| 7 | +[](https://packagist.org/packages/api-clients/twitter) |
| 8 | +[](https://travis-ci.org/php-api-clients/twitter) |
| 9 | + |
| 10 | + |
| 11 | +# Installation |
| 12 | + |
| 13 | +To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`. |
| 14 | + |
| 15 | +``` |
| 16 | +composer require api-clients/twitter |
| 17 | +``` |
| 18 | + |
| 19 | +# Usage |
| 20 | + |
| 21 | +``` |
| 22 | +<?php |
| 23 | +
|
| 24 | +use React\EventLoop\Factory; |
| 25 | +use ApiClients\Client\Twitter\AsyncClient; |
| 26 | +use ApiClients\Client\Twitter\Resource\UserInterface; |
| 27 | +use function ApiClients\Foundation\resource_pretty_print; |
| 28 | +
|
| 29 | +require 'vendor/autoload.php'; |
| 30 | +$config = require 'resolve_config.php'; |
| 31 | +
|
| 32 | +$loop = Factory::create(); |
| 33 | +$client = (new AsyncClient( |
| 34 | + $config['consumer']['key'], |
| 35 | + $config['consumer']['secret'], |
| 36 | + $loop |
| 37 | +))->withAccessToken( |
| 38 | + $config['access_token']['token'], |
| 39 | + $config['access_token']['secret'] |
| 40 | +); |
| 41 | +
|
| 42 | +$client->user('php_api_clients')->done(function (UserInterface $user) { |
| 43 | + resource_pretty_print($user); |
| 44 | +}); |
| 45 | +
|
| 46 | +$loop->run(); |
| 47 | +``` |
| 48 | + |
| 49 | +# License |
| 50 | + |
| 51 | +The MIT License (MIT) |
| 52 | + |
| 53 | +Copyright (c) 2016 Cees-Jan Kiewiet |
| 54 | + |
| 55 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 56 | +of this software and associated documentation files (the "Software"), to deal |
| 57 | +in the Software without restriction, including without limitation the rights |
| 58 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 59 | +copies of the Software, and to permit persons to whom the Software is |
| 60 | +furnished to do so, subject to the following conditions: |
| 61 | + |
| 62 | +The above copyright notice and this permission notice shall be included in all |
| 63 | +copies or substantial portions of the Software. |
| 64 | + |
| 65 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 66 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 67 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 68 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 69 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 70 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 71 | +SOFTWARE. |
0 commit comments