You are browsing the Symfony 4 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 4 yet, browse the Symfony 3.4 documentation.

Switching the Profiler Storage

4.0 version

Switching the Profiler StorageΒΆ

The profiler 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:

  • YAML
    1
    2
    3
    4
    # config/packages/dev/web_profiler.yaml
    framework:
        profiler:
            dsn: 'file:/tmp/symfony/profiler'
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    <!-- config/packages/dev/web_profiler.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
            http://symfony.com/schema/dic/services/services-1.0.xsd
            http://symfony.com/schema/dic/symfony
            http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
    
        <framework:config>
            <framework:profiler dsn="file:/tmp/symfony/profiler" />
        </framework:config>
    </container>
    
  • PHP
    1
    2
    3
    4
    5
    6
    7
    8
    // config/packages/dev/web_profiler.php
    
    // ...
    $container->loadFromExtension('framework', array(
        'profiler' => array(
            'dsn' => 'file:/tmp/symfony/profiler',
        ),
    ));
    

You can also create your own profile storage service implementing the ProfilerStorageInterface and overriding the profiler.storage service.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.