app/AppKernel.php
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
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\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Ayaline\Bundle\ComposerBundle\AyalineComposerBundle(),
new Nelmio\SecurityBundle\NelmioSecurityBundle(),
new Sonata\NotificationBundle\SonataNotificationBundle(),
new Lopi\Bundle\PusherBundle\LopiPusherBundle(),
new Liip\MonitorBundle\LiipMonitorBundle(),
new Evolution7\BugsnagBundle\BugsnagBundle(),
];
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* {@inheritdoc}
*/
public function getCacheDir()
{
if ($this->isVagrantEnvironment()) {
return '/dev/shm/composer-service/cache/'.$this->environment;
}
return parent::getCacheDir();
}
/**
* {@inheritdoc}
*/
public function getLogDir()
{
if ($this->isVagrantEnvironment()) {
return '/dev/shm/composer-service/logs';
}
return parent::getLogDir();
}
/**
* @return bool
*/
private function isVagrantEnvironment()
{
return (getenv('HOME') === '/home/vagrant'
|| getenv('VAGRANT') === 'VAGRANT') && is_dir('/dev/shm');
}
}