I am looking to confirm how my app*.php files should be configured with regards to the bootstrap.php.cache
file.
I have read some conflicting advice on how to treat this file in Symfony 3.0 and above, namely https://symfonycasts.com/screencast/symfony3-upgrade/new-dir-structure#moving-bootstrap-php-cache and https://gist.github.com/mickaelandrieu/5d27a2ffafcbdd64912f549aaf2a6df9#files-to-move-update-
My understanding is that bootstrap.php.cache
is required for a performance boost and is only required or recommended in the 'prod' environment. So this leaves me with the following setup:
app.php
:
/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
$kernel = new AppKernel('prod', false);
app_dev.php
:
/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
Debug::enable();
$kernel = new AppKernel('dev', true);
Previously $loader
was /app/autoload.php
, which has been moved to /vendor
and /app/bootstrap.php.cache
has been deleted and the DistrubutionBundle is now writing that file to /var
.
Is this setup correct? (bin/console --env=dev/prod returns no errors)