before going in production with Symfony 2 I noticed there are a lot of bundles that are loaded by the framework in AppKernel.php. The defaults are:
$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 JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
);
I use assetic, doctrine, twig, framework, monolog bundles. Can I safely remove the others so that the speed of loading will raise?
You can safely remove the SwiftmailerBundle.
The other ones (SecurityBundle, SensioFrameworkExtraBundle, JMSSecurityExtraBundle) may be harder as they have relations and your bundles may also have dependencies.
I would go ahead and just remove one bundle, run my tests (or manually test, if you don’t have some) and see what’s happening. If everything works, you can remove the next one.
Make sure to delete the cache after each removal (just to be safe).