Installing GearmanBundle


You have two options to install GearmanBundle in Symfony2 framework: using vendors or by project clone. Both options are based on the same basics, but one requires a little more configuration.

On one hand, we can set ourselves the repository as follows

                        %/vendor/bundles[master]: mkdir Mmoreramerino && cd Mmoreramerino
%/vendor/bundles/Mmoreramerino[master]: git clone git://github.com/mmoreramerino/GearmanBundle.git

On the other hand, you can include this repository on the list of vendors and reinstall it again. You must edit your "deps" file in your project root

                        %/deps
                        [GearmanBundle]
    git=http://github.com/mmoreramerino/GearmanBundle.git
    target=/bundles/Mmoreramerino/GearmanBundle

You can specify the Gearman branch. By default, development branch is set, but you can specify the stable release by setting master branch

                        %/deps
                        [GearmanBundle]
    git=http://github.com/mmoreramerino/GearmanBundle.git
    target=/bundles/Mmoreramerino/GearmanBundle
    version=refs/remotes/origin/master

When you have registered the bundle and you're in your project, you just need to instantiate your bundle and to add a line in the autoload.

                        %/app/AppKernel.php
                        <?php

$bundles = array(
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    new Symfony\Bundle\TwigBundle\TwigBundle(),
    new Symfony\Bundle\MonologBundle\MonologBundle(),
    new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
    /**
     * Your bundles
     */
    new Mmoreramerino\GearmanBundle\MmoreramerinoGearmanBundle(),
);

You also need to update autoload file, to make Symfony2 able to find GearmanBundle.

                        %/app/autoload.php
                        <?php

$loader->registerNamespaces(array(
    'Sensio'                 => __DIR__ . '/../vendor/bundles',
    'JMS'                    => __DIR__ . '/../vendor/bundles',
    'Doctrine\\Common'       => __DIR__ . '/../vendor/doctrine-common/lib',
    /**
     * Your namespaces
     */
    'Mmoreramerino'          => __DIR__ . '/../vendor/bundles/Mmoreramerino/GearmanBundle/lib',
));

Once all this is done, you can check if GearmanBundle is already installed by running check command

                        ~/path/to/your/project[master]: php app/console gearman:check
                    

Index  |  next : Settings