phonghaw2/laravel-x-api-v2 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phonghaw2/laravel-x-api-v2

Composer 安装命令:

composer require phonghaw2/laravel-x-api-v2

包简介

A small Laravel package for X API.

README 文档

README

MIT Licensed Total Downloads

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

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

Here are a few examples of the provided methods:

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

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

phonghaw2/laravel-x-api-v2 适用场景与选型建议

phonghaw2/laravel-x-api-v2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「twitter」 「laravel」 「phonghaw2」 「x-api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 phonghaw2/laravel-x-api-v2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 phonghaw2/laravel-x-api-v2 我们能提供哪些服务?
定制开发 / 二次开发

基于 phonghaw2/laravel-x-api-v2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-22