Switching the Profiler Storage
Warning: You are browsing the documentation for Symfony 3.x, which is no longer maintained.
Read the updated version of this page for Symfony 7.1 (the current stable version).
In Symfony versions prior to 3.0, profiles could be stored in files, databases, services like Redis and memcache, etc. Starting from Symfony 3.0, the only storage mechanism with built-in support is the filesystem.
By default, the profile stores the collected data in the %kernel.cache_dir%/profiler/
directory. If you want to use another location to store the profiles, define the
dsn
option of the framework.profiler
:
1 2 3 4
# app/config/config.yml
framework:
profiler:
dsn: 'file:/tmp/symfony/profiler'
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:profiler dsn="file:/tmp/symfony/profiler"/>
</framework:config>
</container>
1 2 3 4 5 6 7 8
// app/config/config.php
// ...
$container->loadFromExtension('framework', [
'profiler' => [
'dsn' => 'file:/tmp/symfony/profiler',
],
]);
You can also create your own profile storage service implementing the
ProfilerStorageInterface and
overriding the profiler.storage
service.