2017 © Pedro Peláez
 

yii2-extension yii2-twittable

The twittable extension for the Yii2 framework

image

cybercog/yii2-twittable

The twittable extension for the Yii2 framework

  • Monday, April 20, 2015
  • by a-komarev
  • Repository
  • 2 Watchers
  • 2 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Twittable Behavior for Yii2

Join the chat at https://gitter.im/cybercog/yii2-twittable, (*1)

This extension provides behavior functions for tweeting., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

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

or add, (*5)

"cybercog/yii2-twittable": "*"

to the require section of your composer.json file., (*6)

Migrations

If you want to auto-post News to twitter, run the following command, (*7)

$ yii migrate/create news_tweet_link

Open the /path/to/migrations/m_xxxxxx_xxxxxx_news_tweet_link.php file,, (*8)

inside the up() method add the following, (*9)

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

inside the down() method add the following, (*10)

$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., (*11)

Todo

  • [x] Limit tags count (recomended max 3 tags per tweet)
  • [x] 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

The Versions

20/04 2015

dev-master

9999999-dev

The twittable extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 twitter twittable

16/02 2015

v0.3

0.3.0.0

The twittable extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 twitter twittable

24/01 2015

v0.2

0.2.0.0

The twittable extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 twitter twittable

24/01 2015

dev-develop

dev-develop

The twittable extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 twitter twittable

24/01 2015

v0.1

0.1.0.0

The twittable extension for the Yii2 framework

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 twitter twittable