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-resource '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/resource.git"}' && \
composer config repositories.openjet-serializer '{"type": "vcs", "reference": "master", "url": "git@gitlab.openjetlab.fr:openjet/serializer.git"}'
And use this command to add the bundle and download the package.
$ composer require openjet/resource-bundle
1.1. Adding required bundles to the kernel¶
You need to enable the bundle inside the kernel.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle($this),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new winzou\Bundle\StateMachineBundle\winzouStateMachineBundle(),
new Sylius\Bundle\ResourceBundle\SyliusResourceBundle(),
new Openjet\Bundle\ResourceBundle\OpenjetResourceBundle(),
// 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.
That’s it! Now you can configure your first resource.