定制 cybercog/yii2-twittable 二次开发

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

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

cybercog/yii2-twittable

最新稳定版本:v0.3

Composer 安装命令:

composer require cybercog/yii2-twittable

包简介

The twittable extension for the Yii2 framework

README 文档

README

Join the chat at https://gitter.im/cybercog/yii2-twittable

This extension provides behavior functions for tweeting.

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require cybercog/yii2-twittable "*"

or add

"cybercog/yii2-twittable": "*"

to the require section of your composer.json file.

Migrations

If you want to auto-post News to twitter, run the following command

$ yii migrate/create news_tweet_link

Open the /path/to/migrations/m_xxxxxx_xxxxxx_news_tweet_link.php file,

inside the up() method add the following

$sql = "ALTER TABLE news
        ADD COLUMN tweet_id BIGINT(64) NULL DEFAULT NULL";
$this->execute($sql);

inside the down() method add the following

$sql = "ALTER TABLE news
        DROP COLUMN tweet_id";
$this->execute($sql);

Configuring

use cybercog\yii\twittable\behaviors\TwittableBehavior;

/**
 * ...
 * @property string $tagNames
 */
class Post extends \yii\db\ActiveRecord
{
    public function behaviors()
    {
        return [
            [
                'class' => TwittableBehavior::className(),
                'consumerKey' => 'TWITTER_CONSUMER_KEY',
                'consumerSecret' => 'TWITTER_SECRET_KEY',
                'accessToken' => 'TWITTER_ACCESS_TOKEN',
                'accessTokenSecret' => 'TWITTER_SECRET_TOKEN',
                'autoPosting' => true,
            ],
        ];
    }
}

Usage

Everything is working automatically right now. When you are creating new model - it's instantly adding a tweet.

Todo

  • Limit tags count (recomended max 3 tags per tweet)
  • Configurable autoposting feature
  • Configuring what to post: message, tags, url
  • Handle twitter errors
  • Manual posting of tweets if tweet isn't exist
  • Tweets deletion
  • Support Twitter cards

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-01-20