2017 © Pedro PelĆ”ez
 

symfony-bundle twitter-app-bundle

Clientless Twitter application instance to help automate project twitter updates

image

inori/twitter-app-bundle

Clientless Twitter application instance to help automate project twitter updates

  • Tuesday, July 14, 2015
  • by Inoryy
  • Repository
  • 1 Watchers
  • 9 Stars
  • 1,534 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

DISCONTINUED

This project is no longer maintained by me. If you want to take over, please get in touch with me at inoryy@gmail.com, (*1)

Introduction

TwitterAppBundle at its core is just a simple proxy bundle between twitteroauth client and symfony2. It is only meant to be used as a clientless app. If you want to add Twitter login/register/etc functionality to your app, please consider using FOS/TwitterBundle instead., (*2)

Example usage

Example use-case for this bundle would be automated twitter messages (from your project account) about certain events in your system., (*3)

Installation

With deps:

Add this bundle and Abraham Williams' Twitter library to your application:, (*4)

[twitteroauth]
    git=http://github.com/abraham/twitteroauth.git

[InoriTwitterAppBundle]
    git=http://github.com/Inori/InoriTwitterAppBundle.git
    target=bundles/Inori/TwitterAppBundle

With composer:

Add this bundle to your composer.json:, (*5)

// composer.json
{
    // ...
    require: {
        // ...
        "inori/twitter-app-bundle": "master"
    }
}

Register the namespace Inori to your project's autoloader bootstrap script:, (*6)

//app/autoload.php
$loader->registerNamespaces(array(
    // ...
    'Inori'    => __DIR__.'/../vendor/bundles',
    // ...
));

Add this bundle to your application's kernel:, (*7)

//app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Inori\TwitterAppBundle\InoriTwitterAppBundle(),
    );
}

Configure the twitter_app service in your YAML configuration:, (*8)

#app/config/config.yml
inori_twitter_app:
    file: %kernel.root_dir%/../vendor/twitteroauth/twitteroauth/twitteroauth.php
    consumer_key: xxxxxx
    consumer_secret: xxxxxx
    oauth_token: xxxxxx
    oauth_token_secret: xxxxxx

NB! To learn how to get keys/tokens, take a look at Twitter Developers documentation. For a quick walkthrough check below., (*9)

Using TwitterApp

If the setup is done correctly, then you can start using TwitterApp like this:, (*10)

// ...
$ta = $this->container->get('twitter_app');
$messages = $ta->getDirectMessages();

TwitterApp comes with some basic methods for easier usage (tweet, follow), but for most of the API features you should use twitteroauth via getApi() method like this:, (*11)

// ...
$ta = $this->container->get('twitter_app');
$trends = $ta->getApi()->get('trends');

Getting Twitter API tokens

  • Login at Twitter Developers page
  • Create your application
  • Go to your app profile page via My applications
  • There you will see Consumer key and Consumer secret under OAuth settings
  • Under Your access token you should see Access token and Access token secret, if not then simply press "Recreate my access token"
  • Make sure Access level is Read, write, and direct messages, if not then then go to Settings tab and under Application Type -> Access choose Read, Write and Access direct messages

The Versions

14/07 2015

dev-master

9999999-dev

Clientless Twitter application instance to help automate project twitter updates

  Sources   Download

MIT

The Requires

 

by Roman MarintŔenko

twitter