2017 © Pedro Peláez
 

library yii2-twitter-api

Yii2 component wrapper for J7mbo/twitter-api-php

image

naffiq/yii2-twitter-api

Yii2 component wrapper for J7mbo/twitter-api-php

  • Thursday, March 30, 2017
  • by naffiq
  • Repository
  • 1 Watchers
  • 0 Stars
  • 139 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Yii2 Twitter API

Test Coverage Code Climate Build Status, (*1)

This package provides component wrapper for J7mbo/twitter-api-php library. Basically it just helps you to move settings to your app config., (*2)

Installation

The preferred way to install this package is through composer:, (*3)

$ composer require naffiq/yii2-twitter-api

Configuration

Add following code to your components config section:, (*4)

<?php
return [
    // Your app settings ...
    'components' => [
        // Other components ...
        'twitter' => [
            'class' => 'naffiq\twitterapi\TwitterAPI',
            'oauthAccessToken' => 'YOUR_OAUTH_ACCESS_TOKEN',
            'oauthAccessTokenSecret' => 'YOUR_OAUTH_ACCESS_TOKEN',
            'consumerKey' => 'YOUR_CONSUMER_KEY',
            'consumerSecret' => 'YOUR_CONSUMER_SECRET'
        ]        
    ]
    // ...
];

And we are ready to roll, (*5)

Usage

Once you set up the component, you can use all of the J7mbo/twitter-api-php library's methods, just like this:, (*6)

<?php

/**
 * @var \naffiq\twitterapi\TwitterAPI $twitter
 */
$twitter = \Yii::$app->get('twitter');

$url = 'https://api.twitter.com/1.1/blocks/create.json';
$requestMethod = 'POST';
$postFields = [
    'screen_name' => 'usernameToBlock', 
    'skip_status' => '1'
];

$twitter->buildOauth($url, $requestMethod)
    ->setPostfields($postFields)
    ->performRequest();

The Versions

30/03 2017

dev-master

9999999-dev

Yii2 component wrapper for J7mbo/twitter-api-php

  Sources   Download

MIT

The Requires

 

The Development Requires

30/03 2017

1.0.0

1.0.0.0

Yii2 component wrapper for J7mbo/twitter-api-php

  Sources   Download

MIT

The Requires

 

The Development Requires