2017 © Pedro Peláez
 

symfony-bundle last-tweet

Symfony 2 bundle to add quickly last tweets on your website

image

renus/last-tweet

Symfony 2 bundle to add quickly last tweets on your website

  • Saturday, December 12, 2015
  • by renus
  • Repository
  • 1 Watchers
  • 1 Stars
  • 180 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

lastTweet

Symfony 2 bundle to add quickly last tweets on your website, you can choose and change the screen name, override template and use your own template, this bundle reqiure dependency on abraham/twitteroauth bundle, (*1)

Installation

prerequisites

when you install RenusLastTweetBundle for symfony, this dependency will be add :, (*2)

https://github.com/abraham/twitteroauth

installation

1. Add this bundle to your project in composer.json:

{
    "require": {
        "renus/last-tweet": "1.*",
    }
}

2. OR Install with composer

composer.phar require renus/last-tweet dev-master

3. Register the bundle

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new \Renus\LastTweetBundle\RenusLastTweetBundle(),
    );
    // ...
}

configuration

application twitter

first you must create an twitter application on https://apps.twitter.com/ ,and create a token (read permission), (*3)

parameters

1.config file

you must add your twitter api parameters in app/config/config.yml, the required parameters must be added like this :, (*4)

# app/config/config.yml
renus_last_tweet:
    twitter:
        consumer_key: "your_application_key"
        consumer_secret: "your_application_secret_key"
        token: "your_application_token"
        token_secret: "your_application_token_secret"

2. routing file

# app/config/routing.yml
renus_last_tweet:
    resource: "@RenusLastTweetBundle/Resources/config/routing.yml"
    prefix:   /

Usage

twig usage:

just add this render command in your twig template (in this example we display the last 3 tweets from the @renus_net account) :, (*5)

{% render path('renus_last_tweet', {screen: 'renus_net', number: 3}) %}

controller usage:

if you want to use it in a controller you can get an entity Array with this code:, (*6)

<?php
// src/controller/someController.php
public function someAction()
{
    $tweets = $this->get('renus.twitter')->getLastTweets($screen, $number);
    // ...

    //if you want retweets and mention 
    $tweets = $this->get('renus.twitter')->getLastTweets($screen, $number, false, true);
}

Override template

if you want to custom the render (in a twig template usage), you cans specify the path of your override template in the app/config/config.yml :, (*7)

config

# app/config/config.yml
renus_last_tweet:
    twitter:
        consumer_key: "your_application_key"
        consumer_secret: "your_application_secret_key"
        token: "your_application_token"
        token_secret: "your_application_token_secret"
    template:
        path: "path/of/custom/template/tweet.html.twig"

template

you can use the "tweets" entitties Array like this :, (*8)

{% for tweet in tweets %}
    <dl>
        <dt>{{ tweet.getDate() }}</dt>
        <dd>{{ tweet.getFormatText() | raw }}</dd>
    </dl>
{% endfor %}

to see all the 'tweet' parameters open the Entity/Tweet.php, (*9)

The Versions

12/12 2015

dev-master

9999999-dev

Symfony 2 bundle to add quickly last tweets on your website

  Sources   Download

MIT

The Requires

 

by Renaud Mioque

symfony 2 tweets twitter last tweets

15/05 2015

v1.0.2

1.0.2.0

Symfony 2 bundle to add quickly last tweets on your website

  Sources   Download

MIT

The Requires

 

by Renaud Mioque

symfony 2 tweets twitter last tweets

09/05 2015

v1.0.1

1.0.1.0

Symfony 2 bundle to add quickly last tweets on your website

  Sources   Download

MIT

The Requires

 

by Renaud Mioque

symfony 2 tweets twitter last tweets

09/05 2015

v1.0

1.0.0.0

Symfony 2 bundle to add quickly last tweets on your website

  Sources   Download

MIT

The Requires

 

by Renaud Mioque

symfony 2 tweets twitter last tweets