kmayo-ss/twitter-stripe

Twitter的OAuth连接器

安装次数: 1,252

依赖项: 1

建议者: 0

安全: 0

星标: 2

关注者: 3

分支: 2

公开问题: 0

类型:silverstripe-module

v1.1.3 2016-01-11 20:49 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:06:32 UTC


README

简介

Twitter模块支持Twitter 1.1版本的OAuth。它使用Twitter库代码bird-php (https://github.com/jublonet/codebird-php)

版权(C)2010-2014 kirk@silverstripe.com

本程序是自由软件:您可以按照自由软件基金会发布的GNU通用公共许可证的条款重新分发和/或修改它,许可证版本为3,或者(根据您的选择)任何后续版本。

本程序的分发是希望它会是有用的,但没有提供任何保证;甚至没有关于其适销性或适用于特定目的的暗示性保证。有关详细信息,请参阅GNU通用公共许可证。

您应该已经随本程序收到GNU通用公共许可证的副本。如果没有,请参阅https://gnu.ac.cn/licenses/

维护者联系方式

* Kirk Mayo kirk (at) silverstripe (dot) com

要求

* SilverStripe 3.0 +

功能

  • 通过OAuth连接到Twitter API 1.1
  • 获取用户的推文时间线

Composer安装

composer require kmayo-ss/twitter-stripe

安装手册

  1. 从GitHub下载模块(将添加Composer支持)
  2. 解压文件(如果您使用的是Windows,请尝试使用7-zip解压tar.gz文件)
  3. 确保解压后的文件夹命名为'twitter-stripe'
  4. 将此目录放置在您的网站根目录中。这个目录包含框架和CMS。
  5. 在浏览器中运行 - /dev/build 以重建数据库。

用法

要使用此模块,您需要将OAuth详细信息添加到配置中,以下是一个示例yml配置

---
Name: mysite
After:
  - 'framework/*'
  - 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSTwitter:
  CONSUMER_KEY: Your Twitter Consumer Key from Twitter dashboard
  CONSUMER_SECRET: Your Twitter Consumer Secret from Twitter dashboard
  OAUTH_TOKEN: Your Twitter OAuth token from Twitter dashboard
  OAUTH_SECRET: Your Twitter OAuth secret from Twitter dashboard
  TWITTER_SCREENNAME: Your Twitter screenname/username

要获取推文,需要调用构造函数和getTweets方法,如下所示

			// setup the instance
			$twitter = new SSTwitter();
			// call the following method to get the number of tweets
			// this example fetches the last tweet you may 
			$tweets = (array)$twitter->getTweets(1);
			$tweet = $tweets[0];

要发送推文,需要调用构造函数并使用sendTweet方法,如下所示

		$twitter = new SSTwitter();
		$twitter->sendTweet('Your updated status');

待办事项

添加更多Twitter功能