wp-pure/twitter-aggregator
Composer 安装命令:
composer require wp-pure/twitter-aggregator
包简介
A Twitter aggregator to aggregate multiple twitter accounts into a single lising. Includes caching - originally intended to work with WordPress - but will also work with any PHP application.
README 文档
README
This script uses the twitter-api-php library to retrieve twitter feeds, aggregate them and cache them. If included in a WordPress theme or plugin, it'll find the WP functions, and the cache folder will be put into the uploads folder. Enough ado, here's a sample integration.
Install via Composer
composer require wp-pure/twitter-aggregator
Include composer's autoloader:
require_once 'vendor/autoload.php';
Obtain Twitter API Keys
Check out the URL below to create a Twitter app and get your keys to use their API.
https://dev.twitter.com/apps/new
Code Examples
Instantiate
// generate an aggregator object $ta = new twitterAggregator( array( // twitter API consumer key, secret, and oath token and oauth secret 'consumer_key' => "[CONSUMER KEY]", 'consumer_secret' => "[CONSUMER SECRET]", 'oauth_access_token' => "[OAUTH ACCESS TOKEN]", 'oauth_access_token_secret' => "[OAUTH ACCESS TOKEN SECRET]", // comma separated list of twitter handles to pull 'usernames' => "[TWITTER USERNAMES]", // set the number of tweets to show 'count' => 10, // set an update interval (minutes) 'update_interval' => 10, // set the cache directory name/path 'cache_dir' => 'cache', // boolean, exclude replies, default true 'exclude_replies' => true, // boolean, include retweets, default true 'include_rts' => true ) );
Methods:
There are multiple ways to use the aggregator once it's instantiated. You can display it, with or without styles, or retrieve the widget code.
// display the widget $ta->display(); // display the widget without any styles $ta->display_unstyled(); // fetch the widget code $code = $ta->widget(); // fetch data $data = $ta->fetch();
If you'd like to directly access the api response data (not limited by the count option), use the $ta->data property after the aggregator object is instantiated.
Developed by James Pederson.
wp-pure/twitter-aggregator 适用场景与选型建议
wp-pure/twitter-aggregator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 113 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 05 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wp-pure/twitter-aggregator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wp-pure/twitter-aggregator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-21