Twitter REST API for PHP 5.3+

Overview

README

Build Status

The Wid'op Twitter REST library is a modern PHP 5.3+ API allowing you to easily interact with Twitter 1.1. In order to sign your request with the OAuth protocol, the library internally uses the widop/twitter-oauth.

use Widop\HttpAdapter\CurlHttpAdapter;
use Widop\Twitter\OAuth;
use Widop\Twitter\Rest\Statuses\StatusesUpdateRequest;
use Widop\Twitter\Rest\Twitter;

// First, instantiate your OAuth client.
$oauth = new OAuth\OAuth(
    new CurlHttpAdapter(),
    new OAuth\OAuthConsumer('consumer_key', 'consumer_secret'),
    new OAuth\Signature\OAuthHmacSha1Signature()
);

// Second, instantiate your OAuth access token.
$token = new OAuth\OAuthToken('oauth_key', 'oauth_secret');

// Third, instantiate your Twitter client.
$twitter = new Twitter($oauth, $token);

// Then, send a request to the Twitter API!
$request = new StatusesUpdateRequest('Yeah, I\'m currently updating my status!')
$tweet = $twitter->send($request)->getData();

Documentation

  1. Installation
  2. Twitter

Testing

The library is fully unit tested by PHPUnit with a code coverage close to 100%. To execute the test suite, check the travis configuration.

Contribute

We love contributors! The library is open source, if you'd like to contribute, feel free to propose a PR!

License

The Wid'op Twitter REST library is under the MIT license. For the full copyright and license information, please read the LICENSE file that was distributed with this source code.

You might also like...
This library is for integration with Salesforce via REST API.

xsolve-pl/salesforce-client Introduction This library is for integration with Salesforce via REST API. Licence This library is under the MIT license.

This package help you build your REST API documentation.

Laravel API Doc This package help you build your REST API documentation. Installation You can install the package via composer: composer require axeld

OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

DigitalOcean API v2 client for Symfony and API Platform

DigitalOcean Bundle for Symfony and API Platform DunglasDigitalOceanBundle allows using the DigitalOcean API from your Symfony and API Platform projec

This package is a simple API laravel wrapper for Pokemontcg with a sleek Model design for API routes and authentication.

This package is a simple API laravel wrapper for Pokemontcg with a sleek Model design for API routes and authentication.

API SDK for OpenTrade Commerce API: Taobao, Alibaba, JD, 1688, Aliexpress, Ebay.

OtapiPhpClient Create Client $client = new OtClient($key, $secret, $lang); key (Access Key) secret (Secret for access key) language (2 symbol lang id

API client for ThePay - payment gate API
API client for ThePay - payment gate API

This is the official highly compatible public package of The Pay SDK which interacts with The Pay's REST API. To get started see examples below.

Code Quiz MonoRepo (API, API Client, App)

Code Quiz Welcome to the Code Quiz Open Source project from How To Code Well. This is an Open Source project that includes an API and an App for the d

⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.
⚡️ Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC.

Web3 PHP is a supercharged PHP API client that allows you to interact with a generic Ethereum RPC. This project is a work-in-progress. Code and docume

Comments
  • Don't return just the body of the reponse

    Don't return just the body of the reponse

    Hello there, thank you for the awesome work.

    I'm looking for a solution for two issues I faced with twitter-rest.

    1. when the request fails, a generic exception is thrown. The message of the exception is mixed with the JSON data of the response. This means you don't get programmatic access to the error code that comes in the JSON data. You also don't get access to the HTTP error code.
    2. in non trivial applications, you need to check your rate limits. One way to do it, is to check the headers of the twitter response. But you don't get access to them either.

    Possible solutions:

    • create a way to get a raw response object, which contains the parsed json data, the headers, etc. It may be a different method, or a optional parameter in Twitter::send(). Ideally, an exception should never be thrown when using this method/parameter.
    • create a specialized exception (let's say TwitterException) with a getResponse() accessor and perhaps some more specialized method. This wouldn't solve the point 2 though, which is of critical importance.

    Let me know what you think.

    opened by tacone 13
  • Introduce request options

    Introduce request options

    The first aim of this PR is to introduce request options in order to avoid duplication in all requests.

    Additionally, the request does not inherit any class anymore in order to avoid method collision due to the usage of the magic method.

    For the moment, it is much more a POC than something else. so, if you agree, then threre is still some tests which need to be written before considering the PR to be merged.

    ping @geoffrey-brier @tmartin

    opened by egeloen 3
Owner
Wid'op
Wid'op
A PHP class for querying the Twitter API and rendering tweets as an HTML list

TweetPHP A PHP class for querying the Twitter API and rendering tweets as an HTML list. Features Works with Twitter API v1.1 Tweets are cached to avoi

Jonathan Nicol 151 Nov 25, 2022
PHP package providing easy and fast access to Twitter API V2.

Twitter API V2 is a PHP package that provides an easy and fast access to Twitter REST API for Version 2 endpoints.

Julien SCHMITT 38 Dec 12, 2022
Twitter API for Laravel 5.5+, 6.x, 7.x & 8.x

Twitter for PHP Twitter API for Laravel 6.x, 7.x, 8.x (and new versions as they are released). Also supports other frameworks via PHP-DI (or feel free

null 879 Dec 17, 2022
Nexmo REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Client Library for PHP Support Notice This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintena

Nexmo 75 Sep 23, 2022
Get the twitter user authentication keys

TwitterLogin Get the twitter user authentication keys Step 1: Go to Twitter Developer Portal and Apply to create app. Step 2: Go to app setting and en

Mohammad Zarchi 1 Nov 21, 2021
A PHP library for communicating with the Twilio REST API and generating TwiML.

twilio-php The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio API c

Twilio 1.4k Jan 2, 2023
PHP library to use IOTA REST API to help node management and tangle queries

iota.php About PHP library to use IOTA REST API to help node management and tangle queries. Please be aware that this library is in an early developme

IOTA Community 45 Dec 13, 2022
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit 96 Jan 6, 2023
Interacting with Mastodon's REST API for Kirby v3

Kirby3 Mastodon This plugin provides access to your Mastodon statuses, called 'toots'. Getting started Use one of the following methods to install & u

Fundevogel 5 Dec 31, 2022
Пакет позволяющий работать с REST API SMS-сервиса «SMS Aero»

SMS-сервис «SMS Aero» ?? Пакет позволяющий работать с REST API SMS-сервиса «SMS Aero» ?? Изменения: Все заметные изменения в этом проекте будут задоку

Артём Соколовский 2 Feb 6, 2022