PHPackages                             phonghaw2/laravel-x-api-v2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. phonghaw2/laravel-x-api-v2

ActiveLibrary[API Development](/categories/api)

phonghaw2/laravel-x-api-v2
==========================

A small Laravel package for X API.

v1.0.0(1y ago)31MITPHPPHP &gt;=7.4

Since Feb 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/phonghaw2/laravel-x-api-v2)[ Packagist](https://packagist.org/packages/phonghaw2/laravel-x-api-v2)[ Docs](https://github.com/phonghaw2/laravel-x-api-v2)[ RSS](/packages/phonghaw2-laravel-x-api-v2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

A Laravel package for the Twitter REST API V2 endpoints.
========================================================

[](#a-laravel-package-for-the-twitter-rest-api-v2-endpoints)

[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/27be07466d40bfc51054e95fc2852443a4c51146233edb2b1161b65cbe7ebec1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70686f6e67686177322f6c61726176656c2d676f6f676c652d616e616c79746963732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phonghaw2/laravel-google-analytics)

Installation
------------

[](#installation)

> For Laravel ^6.0|^7.0|^8.0

This package can be installed through Composer.

```
composer require phonghaw2/laravel-x-api-v2
```

Optionally, you can publish the config file of this package with this command:

```
php artisan vendor:publish --provider="Phonghaw2\X\XServiceProvider"
```

Config
------

[](#config)

The following config file will be published in `config/x.php`

```
return [
    'api_base_uri' => 'https://api.twitter.com/2/',

    // The unique identifier for the Twitter account.
    // Account ID of the Twitter user
    'app_id' => env('X_APP_ID', 1),

    // Your Twitter API consumer key (public key), obtained from the Twitter Developer Portal.
    // This key is used to identify your app when making API requests. (Consumer API key)
    'api_key' => env('X_APP_KEY', 'CONSUMER_KEY'),

    // Your Twitter API consumer secret, also obtained from the Twitter Developer Portal.
    'api_key_secret' => env('X_APP_KEY_SECRET', 'CONSUMER_SECRET'),

    // The bearer token, used for OAuth 2.0 authentication.
    // It is used in the HTTP headers when making requests to Twitter's API without the need for user authentication.
    'bearer_token' => env('X_BEARER_TOKEN', 'BEARER_TOKEN'),

    // Access token, used for user authentication and authorization for Twitter API access on behalf of the user.
    // You must request this token after getting user consent.
    'access_token' => env('X_ACCESS_TOKEN', 'ACCESS_TOKEN'),

    // Access token secret, paired with the access token to authenticate and authorize API calls.
    'access_token_secret' => env('X_ACCESS_TOKEN_SECRET', 'ACCESS_TOKEN_SECRET'),
];
```

Usage
-----

[](#usage)

Here are a few examples of the provided methods:

### TweetLookup

[](#tweetlookup)

```
use Twitter;
// Post lookup by Post IDs
Twitter::tweetLookup()
->setQueryParams([
    'ids' => 111111111,
    'max_results' => 5, // Must be a number between 1 and 100 (default: 100)
    'pagination_token' => '5qym3iwo3naekslszn59lxy1d9nmc6q'
])
->lookupPost();

// Creation of a Post
Twitter::tweetLookup()
->setPostData([
    'media' => [
        "media_ids": [
            "11111"
        ],
        "tagged_user_ids": [
            "2222"
        ]
    ],
])
->create()
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance44

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

444d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/77c6e6a0ec8705863f9b64d495e2a45f8b8e3a0bf685774a706be5eff27615f5?d=identicon)[phonghaw2](/maintainers/phonghaw2)

---

Top Contributors

[![phonghaw2](https://avatars.githubusercontent.com/u/77913075?v=4)](https://github.com/phonghaw2 "phonghaw2 (2 commits)")

---

Tags

laraveltwitterphonghaw2x-api

### Embed Badge

![Health badge](/badges/phonghaw2-laravel-x-api-v2/health.svg)

```
[![Health](https://phpackages.com/badges/phonghaw2-laravel-x-api-v2/health.svg)](https://phpackages.com/packages/phonghaw2-laravel-x-api-v2)
```

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[atymic/twitter

Twitter API for PHP &amp; Laravel

945555.4k2](/packages/atymic-twitter)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)[edujugon/social-auto-post

PHP and Laravel 5 Package to post on Twitter

135.9k](/packages/edujugon-social-auto-post)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
