trendix/twitter-bundle

Twitter login and other functionalities

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

Language:JavaScript

Type:symfony-bundle

dev-master 2017-05-22 06:51 UTC

This package is not auto-updated.

Last update: 2025-06-08 05:50:28 UTC


README

Welcome to our brand new Twitter Bundle. With this bundle, you can easily authenticate a user at twitter so your Symfony 2.8 or 3.* application can read and tweet on user's behalf with their authorization.

This project is still at alpha, but we are going to improve its functionality and documentation soon enough.

How can I install this bundle?

  1. Install our bundle using composer:
composer require trendix/twitter-bundle
  1. Create and configure a Twitter app, if you don't have one already.
  2. In the app Setting, set the Callback URL to the URL use to login and redirect the user to the app (by default the route is called trendix_twitter_login, look at TwitterController:twitterLogin).
  3. Add to the Kernel our bundle:
$bundles = array(
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    ...
    new Trendix\TwitterBundle\TrendixTwitterBundle(),
);
   
  1. Add also the routing configuration to your routing.yml:
trendix_twitter:
    resource: "@TrendixTwitterBundle/Resources/config/routing.yml"
    prefix:   /
  1. Add these five parameters to your parameters.yml with your twitter app data:, at "Keys and Access Tokens" tab:
parameters:
    ...
    secret: ThisTokenIsNotSoSecretChangeIt
    twitter_consumer: '' # Consumer Key (API Key)
    twitter_consumer_secret: '' # Consumer Secret (API Secret)
    twitter_access_token: '' # Access Token
    twitter_access_token_secret: '' # Access Token Secret
    twitter_salt: '' # Used for security. Just put a phrase or any string and don't tell it to anyone else.

How can I use this bundle?

Just follow our DefaultController:test example. Just include our twitter_widget and twitter_includes in your template and it should be ready to work.

You can always use your own css to overwrite its style

Custom your widget

Using our controllers as an example, you can easily change the twig template, css, js or even do completely different controllers. The TwitterAPI class is the center of the twitter behaviour, so you can use only that if you want :D

EU Warning

Our bundle uses the jquery.cookie plugin to store the user token data so the browser can keep their session when refreshing or changing pages. Disabling this feature is not recommended, but if you work at the EU, yo have to state your Cookies Policy and request the user for their consent before using these cookies.

We recommend using http://cookiecuttr.com/ in order to avoid any legal issues.