Symfony2 bundle to access the profiles via Xing- and Linkedin-API, uses HybridAuth

Installs: 3 899

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 1

Open Issues: 1


1.0.0 2016-02-03 22:53 UTC


Symfony2 bundle to integrate the HybridAuth library to get access the API of various social networks.

See for more details on the integrated library.

Available APIs

A lot of providers are available. See the following two links for a complete list:


To install AzineHybridAuthBundle with Composer just add the following to your composer.json file:

// composer.json
    // ...
    require: {
        // ...
        "azine/hybridauth-bundle": "dev-master"

Then, you can install the new dependencies by running Composer’s update command from the directory where your composer.json file is located:

php composer.phar update

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:


// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Azine\HybridAuthBundle\AzineHybridAuthBundle(),
    // ...

Register the routes of the AzineHybridAuthBundle:

// in app/config/routing.yml

    resource: "@AzineHybridAuthBundle/Resources/config/routing.yml"
    prefix:   /hybrid-auth/

If you want to store the users authentication session in the database, so the user is automatically reconnected in the next browser session, then you need to enable this feature in the config.yml and update your database schema either by running:

php app/console doctrine:schema:update --force

or create a database migration and apply it

php app/console doctrine:migrations:diff
php app/console doctrine:migrations:migrate

Create apps on your preferred social networks/providers

LinkedIn =>


Configure at least one provider. See the links above for a list of available providers.

The providers in the "hybridauth\hybridauth\Hybrid\Providers"-folder are available by default via their ID, the providers in the "hybridauth\additional-providers"-folder must be configured. => see the configuration of the wrapper for the linkedIn provider below.

For the LinkedIn provider there are some extra functionalities implemented. For all others, there's the default functionality from the HybridAuth available.


// Default configuration for "AzineHybridAuthBundle"
    endpoint_route:       azine_hybrid_auth_endpoint # the route_name where your endpoint controller (e.g. HybridEndPointController) is available
    debug:                false # set to true to log debug-information to the debug_file
    debug_file:           '%kernel.logs_dir%/hybrid_auth_%kernel.environment%.log' # location of the debug-file
    store_for_user:       false # set to true to store hybrid auth session data into your database for the logged in user
    store_as_cookie:      false # set to true if session-information should be stored as cookies (e.g. for anon. users)

        # Prototype (at least one provider has to be defined)
            enabled:              true
            scope:                ~ # comma-separated list of required 'access rights'
              path: ~               # full path to the file containing the wrapper class
              class: ~              # the wrapper class
                key:                  ~ # your api-key for this provider
                secret:               ~ # your secret for this provider

Here's the example for the linkedin provider:

            enabled: true
            scope: "r_ basicprofile, r_network"
                key: %linkedin_api_key%
                secret: %linkedin_api_secret%

Define the keys and secrets for linkedin in you parameters.yml.dist file.


This service / provider offers some confienience methods to work with business-networks (LinkedIn). All methods expect the user to be "connected" to linkedin. If the user has not yet authorized your app to access the data, a http-redirect will be output directly by setting the html-header-location and calling "die".

Not cached, not paged.


Get all linkedIn contacts of the current user.

Not cached, not paged.

As of May 2015 LinkedIn has limited the api-access. See

Getting the LinkedinContacts will only work if you are in a LinkedIn partner programm and are allowed to access. See

getContactProfiles($pageSize = 50, $offset = 0)

Get all contacts of the current user. Cached and paged.

The function getContactProfiles($pageSize = 50, $offset = 0) get's one page of contacts from the business networks.

The first call will take a fair bit longer than the following ones, because on the first call, ALL contacts from both networks are fetched and stored in one big array, sorted by last name. This collection is then stored in the user session.


Contributions are very welcome. Please fork the repository and issue your pull-request against the master branch.

The PR should:

  • contain a description what the PR solves or adds to the bundle (reference existing issues if applicable)
  • contain clean code with some iniline documentation and phpdocs, no "pure whitespace" changes.
  • respect the Symfony best practices and coding style
  • have phpunit tests covering the new feature or fix
  • result in a 'green' build for your branch on before you issue the PR

Code style

You can check the code style with the php-cs-fixer. Optionally you can set up a pre-commit hook which contains the php-cs-fixer check. Also see

All you have to do is to move pre-commit.sample file from commit-hooks/ to .git/hooks/ folder and rename it to pre-commit.

php-cs-fixer will check the style of your new added code each time you commit and apply fixes to the commit.

To run php-cs-fixer manually, install dependencies (composer install) and execute php vendor/friendsofphp/php-cs-fixer/php-cs-fixer --diff --dry-run -v fix --config=.php_cs.dist .

Build-Status ec.

Build Status Total Downloads Latest Stable Version Scrutinizer Quality Score Code Coverage