Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ferrysyahrinal/twifer
https://github.com/ferrysyahrinal/twifer
php php-library simple-library twitter twitter-api twitter-api-v2
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ferrysyahrinal/twifer
- Owner: ferrysyahrinal
- Created: 2024-01-04T08:22:22.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-01-04T08:27:59.000Z (6 months ago)
- Last Synced: 2024-04-25T17:33:34.116Z (2 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
Lists
- awesome-modern-twitter-api - twifer - Simple PHP Library for Twitter API. (Libraries / PHP)
README
## Twifer
Simple PHP Library for Twitter API Standard v1.1 & Twitter API v2
- Coded with :heart: by [@senggolbaok](https://twitter.com/senggolbaok)
- Buy Me a Cigarette : https://trakteer.id/setandarisurga :smoking:## Installation
### Install with composer
```
composer require ferrysyahrinal/twifer
``````php
request(method, resource, parameter);
``````php
// Post tweet
$parameter = ['status' => 'Hi World'];
$req = $conn->request('POST', 'statuses/update', $parameter);
print_r($req);
``````php
// Delete tweet
$id = '1512864814338506753'; //id tweet
$req = $conn->request('POST', 'statuses/destroy/' . $id);
print_r($req);
``````php
// Get direct message
$req = $conn->request('GET', 'direct_messages/events/list');
print_r($req);
``````php
// Fetch image direct message / save image in direct message
$imgUrl = 'https://ton.twitter.com/i/ton/data/dm/1512867595292057605/1512867589323882496/_6uELIwA.png'; //img url in direct message
$req = $conn->file($imgUrl);
file_put_contents('saveImage.jpg', $req);
//print_r(base64_encode($req));
``````php
// Lookup users
$parameter = ['screen_name' => 'senggolbaok'];
$req = $conn->request('GET', 'users/lookup', $parameter);
print_r($req);
```See more example : [examples/](examples/)
Read more : https://developer.twitter.com/en/docs/twitter-api/v1 to know other parameters.
Twitter API v2 calls : https://developer.twitter.com/apitools/api## License
This open-source software is distributed under the MIT License. See [License](LICENSE)## Contributing
All kinds of contributions are welcome.
- Bug reports.
- Fix bugs / add new features.