定制 xima/xima-twitter-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

xima/xima-twitter-client

Composer 安装命令:

composer require xima/xima-twitter-client

包简介

Import and display tweets

README 文档

README

Extension icon

TYPO3 extension xima_twitter_client

Supported TYPO3 versions Composer

This extension uses the Twitter/X API v2 to import and display tweets. It provides a scheduler command for automated imports and a content element for frontend display.

Backend Wizard preview

Requirements

To use the Twitter API, you need a developer account at developer.twitter.com. Register your application and obtain:

  • API Key (Consumer Key)
  • API Secret (Consumer Secret)
  • Access Token
  • Access Token Secret

The database must be configured to use the utf8mb4 charset and collation. The standard MySQL utf8 charset does not support 4-byte characters such as emojis, which are common in tweets. Without utf8mb4, saving tweets containing emojis will produce an SQL error.

Install

Composer

composer require xima/xima-twitter-client

TER

TER version

Download the zip file from TYPO3 extension repository (TER).

Setup

1. Add Site Set

Add the extension's site set to your site configuration (config/sites/<your-site>/config.yaml):

sets:
    - xima/xima-twitter-client

This automatically includes the TypoScript and PageTSconfig.

2. Configure API Credentials

Add the credentials to your extension configuration (e.g., in additional.php):

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['xima_twitter_client'] = [
    'api_key' => 'your-api-key',
    'api_secret' => 'your-api-secret',
    'access_key' => 'your-access-token',
    'access_secret' => 'your-access-token-secret',
    'image_storage' => '1:Images/Twitter',
];

3. Create Account Records

  1. Create a new SysFolder and enable the "Twitter" module
  2. Add a new Account record inside this folder
  3. Enter the Twitter username you want to fetch tweets from
  4. Configure the maximum number of tweets to fetch

Backend account form

Usage

Import Command

Fetch tweets from all configured accounts:

vendor/bin/typo3 twitter:fetchTweets

Command Options

Option Description
--account, -a Fetch tweets for a specific account UID only
--dry-run Validate configuration without fetching tweets
-v Verbose output with detailed error messages

Examples

# Fetch tweets for all accounts
vendor/bin/typo3 twitter:fetchTweets

# Fetch tweets for a specific account
vendor/bin/typo3 twitter:fetchTweets --account=5

# Validate configuration only
vendor/bin/typo3 twitter:fetchTweets --dry-run

# Verbose output for debugging
vendor/bin/typo3 twitter:fetchTweets -v

Cleanup Command

Remove tweets (and their associated images) older than a given number of days:

vendor/bin/typo3 twitter:cleanupTweets

Command Options

Option Description
--lifetime, -l Maximum age of tweets in days (default: 180)
--dry-run Preview what would be deleted without actually deleting

Examples

# Remove tweets older than 180 days (default)
vendor/bin/typo3 twitter:cleanupTweets

# Remove tweets older than 90 days
vendor/bin/typo3 twitter:cleanupTweets --lifetime=90

# Preview what would be deleted
vendor/bin/typo3 twitter:cleanupTweets --dry-run

Scheduler Task

You can set up both the import and cleanup commands as scheduler tasks for automated execution.

Content Element

Add the Twitter content element to any page to display the imported tweets:

Frontend feed

Configuration

Site Settings

Override the default settings in your site configuration (config/sites/<your-site>/settings.yaml):

plugin:
    tx_ximatwitterclient:
        settings:
            maxItems: 10

Extension Configuration

Key Description Example
api_key Twitter API Key
api_secret Twitter API Secret
access_key Twitter Access Token
access_secret Twitter Access Token Secret
image_storage FAL storage path for downloaded images 1:Images/Twitter

Troubleshooting

API Authentication Errors

Ensure all four API credentials are correctly configured. Use the --dry-run option to validate your configuration:

vendor/bin/typo3 twitter:fetchTweets --dry-run

Image Storage Errors

Make sure the configured image_storage path exists and is writable. The path should be a valid FAL combined identifier (e.g., 1:Images/Twitter).

Rate Limiting

The Twitter API has rate limits. If you encounter rate limit errors, reduce the import frequency or the number of tweets fetched per account.

License

This project is licensed under GNU General Public License 2.0 (or later).

Contribute

This extension was made by Maik Schneider. Feel free to contribute!

Thanks to XIMA!

xima/xima-twitter-client 适用场景与选型建议

xima/xima-twitter-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 xima/xima-twitter-client 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 4.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-01-08