User Tools

Site Tools


symfony:symfony_tutorial_notes:the_bundle_system

This is an old revision of the document!


The Bundle System

Everything in Symfomy is a bundle.

  • src/AppBundle is your app.
  • vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle is the framework itself.
  • In reality, a bundle can live anywhere as long as it can be autoloaded (via app/autoload.php).

Enabling bundles

Enabling bundles is done by hacking AppKernel.registerBundles():

app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
        new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new AppBundle\AppBundle(),
    );
 
    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }
 
    return $bundles;
}
symfony/symfony_tutorial_notes/the_bundle_system.1442451291.txt.gz · Last modified: 2015/09/17 00:54 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki