1. Installation¶
We assume you’re familiar with Composer and you have Composer installed globally.
Use the following command to add repository configuration to your composer.json.
composer config repositories.openjet-core '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/core.git"}' && \
composer config repositories.openjet-core-bundle '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/core-bundle.git"}' && \
composer config repositories.openjet-resource '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/resource.git"}' && \
composer config repositories.openjet-resource-bundle '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/resource-bundle.git"}' && \
composer config repositories.openjet-serializer '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/serializer.git"}' && \
composer config repositories.openjet-oauth '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/oauth.git"}' && \
composer config repositories.openjet-oauth-bundle '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/oauth-bundle.git"}'
And use this command to add the bundle and download the package.
$ composer require openjet/oauth-bundle
1.1. Adding required bundles to the kernel¶
You need to enable the bundle inside the kernel.
If you’re not using any other Openjet bundles, you will also need to add OpenjetResourceBundle and its dependencies to kernel.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Openjet\Bundle\CoreBundle\OpenjetCoreBundle(),
new Openjet\Bundle\ResourceBundle\OpenjetResourceBundle(),
new Openjet\Bundle\OauthBundle\OpenjetOauthBundle(),
// Other bundles...
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
];
}
Note
Please register the bundle before DoctrineBundle. This is important as we use listeners which have to be processed first.
1.2. Container configuration¶
Put this configuration inside your app/config/config.yml.
openjet_oauth:
driver: doctrine/orm
services:
user_provider: openjet.user_provider.username_or_email
options:
supported_scopes: my_scope another_scope
resources:
oauth_user:
classes:
model: Openjet\Component\User\Model\User
1.3. Routing configuration¶
Put this configuration inside your app/config/routing.yml.
openjet_oauth:
resource: "@OpenjetOauthBundle/Resources/config/routing.yml"
1.4. Updating database schema¶
Run the following command.
$ bin/console doctrine:schema:update --force
Warning
This should be done only in dev environment! We recommend using Doctrine migrations, to safely update your schema.
Congratulations! The bundle is now installed and ready to use.