Symfony 2/3/4 profiler extension, to change the Carbon php date in the whole project.
Install the package with composer.
composer require dem3trio/carbon-profiler-bundle --dev
As the package adds a new panel in the Symfony profiler, you should add the bundle under
the dev
section.
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ... prod bundles
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
// ... dev bundles
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Dem3trio\Bundle\CarbonProfilerBundle\CarbonProfilerBundle();
}
}
}
//
Add the routing file under the routing_dev.yml file
# app/config/routing_dev.yml
_time_machine:
resource: '@CarbonProfilerBundle/Resources/config/routing.yml'
prefix: /_time_machine
Add the bundle to your bundles.php
// config/bundles.php
<?php
return [
// ...
Dem3trio\Bundle\CarbonProfilerBundle\CarbonProfilerBundle::class => ['dev' => true],
];
And add the routing file:
# config/routes/dev/carbon_profiler.yml
_time_machine:
resource: '@CarbonProfilerBundle/Resources/config/routing.yml'
prefix: /_time_machine