Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require ss/twitter-bundle "*@dev" -dev
This command requires you to have Composer installed globally, as explained
in the installation chapter
_ of the Composer documentation.
Then, enable the bundle by adding the following line in the app/AppKernel.php
file of your project:
<?php
// app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new SS\TwitterBundle\SSTwitterBundle(),
);
// ...
}
}
Below is the configuration necessary to use the SSTwitterBundle in your application:
# app/config/config.yml
parameters:
twitter_api.key: YOUR_CONSUMER_KEY
twitter_api.key_secret: YOUR_CONSUMER_SECRET
You should call the ss_twitter_api service, this is an exemple on controller :
<?php
/**
* @Route("/app/hometimeline", name="hometimeline")
*/
public function indexAction()
{
$twitter = $this->get('ss_twitter_api');
$twitter_object = $twitter->getUserTimeLine('salemsaiid',10);
return $this->render('AppBundle:Default:index.html.twig', array(
'twitter_object' => $twitter_object
));
}