Download the PHP package friendsofsymfony/twitter-bundle without Composer

On this page you can find all versions of the php package friendsofsymfony/twitter-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package twitter-bundle

DEPRECATED

See HWIOAuthBundle instead

Introduction

This Bundle enables integration with Twitter PHP. Furthermore it also provides a Symfony2 authentication provider so that users can login to a Symfony2 application via Twitter. Furthermore via custom user provider support the Twitter login can also be integrated with other data sources like the database based solution provided by FOSUserBundle.

If you are using Symfony 2.0 switch to the branch v1.0 of TwitterBundle or use the tag 1.0.0

Build Status

Installation

  1. Add this bundle and Abraham Williams' Twitter library to your project as Git submodules:

      $ git submodule add git://github.com/FriendsOfSymfony/FOSTwitterBundle.git vendor/bundles/FOS/TwitterBundle
      $ git submodule add git://github.com/kertz/twitteroauth.git vendor/twitteroauth

Note: The kertz/twitteroauth is patched to be compatible with FOSTwitterBundle

  1. Register the namespace FOS to your project's autoloader bootstrap script:

      //app/autoload.php
      $loader->registerNamespaces(array(
            // ...
            'FOS'    => __DIR__.'/../vendor/bundles',
            // ...
      ));
  2. Add this bundle to your application's kernel:

      //app/AppKernel.php
      public function registerBundles()
      {
          return array(
              // ...
              new FOS\TwitterBundle\FOSTwitterBundle(),
              // ...
          );
      }
  3. Configure the twitter service in your YAML configuration:

        #app/config/config.yml
        fos_twitter:
            file: %kernel.root_dir%/../vendor/twitteroauth/twitteroauth/twitteroauth.php
            consumer_key: xxxxxx
            consumer_secret: xxxxxx
            callback_url: http://www.example.com/login_check
  4. Add the following configuration to use the security component:

        #app/config/security.yml
        security:
            providers:
                fos_twitter:
                    id: fos_twitter.auth
            firewalls:
                secured:
                    pattern:   /secured/.*
                    fos_twitter: true
                public:
                    pattern:   /.*
                    anonymous: true
                    fos_twitter: true
                    logout: true
            access_control:
                - { path: /.*, role: [IS_AUTHENTICATED_ANONYMOUSLY] }

Using Twitter @Anywhere

Note: If you want the Security Component to work with Twitter @Anywhere, you need to send a request to the configured check path upon successful client authentication (see https://gist.github.com/1021384 for a sample configuration).

A templating helper is included for using Twitter @Anywhere. To use it, first call the ->setup() method toward the top of your DOM:

    <!-- inside a php template -->

    </head>

    <!-- inside a twig template -->
      {{ twitter_anywhere_setup() }}
    </head>

Once that's done, you can queue up JavaScript to be run once the library is actually loaded:

    <!-- inside a php template -->
    <span id="twitter_connect"></span>

    <!-- inside a twig template -->
    <span id="twitter_connect"></span>
    {{ twitter_anywhere_setConfig('callbackURL', 'http://www.example.com/login_check') }}
    {{ twitter_anywhere_queue('T("#twitter_connect").connectButton()') }}

Finally, call the ->initialize() method toward the bottom of the DOM:

    <!-- inside a php template -->

    </body>

    <!-- inside a twig template -->
    {{ twitter_anywhere_initialize() }}
    </body>

Configuring Twitter @Anywhere

You can set configuration using the templating helper. with the setConfig() method.

Example Custom User Provider using the FOSUserBundle

To use this provider you will need to add a new service in your config.yml

Also you would need some new properties and methods in your User model class.

And this is the TwitterUserProvider class

Finally, to get the authentication tokens from Twitter you would need to create an action in your controller like this one.

You can create a button in your Twig template that will send the user to authenticate with Twitter.

Remember to edit your security.yml to use this provider


All versions of twitter-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
symfony/framework-bundle Version 2.*
symfony/security-bundle Version 2.0.*
kertz/twitteroauth Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package friendsofsymfony/twitter-bundle contains the following files

Loading the files please wait ....