Description
This package is an X (formerly Twitter) API client for PHP, built for Laravel and usable with other frameworks through PHP-DI. The README says it targets Laravel 10 and 11, and newer releases as they come out. It covers both the v1.1 and v2 X APIs. You can set the default version with the TWITTER_API_VERSION environment variable, or switch between clients with Twitter::forApiV2() and Twitter::forApiV1(). Responses come back as objects or JSON, chosen with a response_format option on each call. The README lists the endpoints by group, such as account settings and credentials. Setup needs an app and an access token created in the Application Management area of X. Laravel configuration uses variables in your .env file, and advanced settings can be published with an artisan command. Version 3.x is the current major release, and 2.x no longer receives bug fixes. It is for PHP developers who want to call the X API from a Laravel app.…
Highlights
- X API v1.1 and v2 clients in one package
- Switch API versions per call with forApiV1 and forApiV2
- Object or JSON responses through response_format
- Laravel service provider configured with environment variables
Ratings & Reviews
No ratings yet
Be the first to rate Twitter.
People also visit
Laravel Twitter Streaming API
Easily work with the Twitter Streaming API in a Laravel app
Twitter FAQ
What is it?
A PHP package for calling the X (formerly Twitter) API from Laravel, with support for other frameworks through PHP-DI.
Which Laravel versions does it support?
The README says it targets Laravel 10 and 11, and newer versions as they are released.
How do I set it up?
Create an app and an access token in the Application Management area of X, set the variables in your .env file, and optionally publish the config with the artisan command in the README.
Which version should I use?
3.x is the current major version and is not backward compatible with 2.x. 2.x is no longer maintained, and UPGRADE.md describes the move to 3.x.
Is it open source?
Yes. The code is public on GitHub.
What are the best Twitter alternatives?
Popular alternatives to Twitter include Laravel Twitter Streaming API, GetXAPI and TwitterAPIs. See all Twitter alternatives









