Skip to content

Commit 03ff7c9

Browse files
committed
Merge pull request symfony#3344 from xabbuh/issue-2112
documentation for configuring the profiler storage
2 parents 55dbd0b + 5546fc2 commit 03ff7c9

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104

105105
* :doc:`/cookbook/profiler/data_collector`
106106
* :doc:`/cookbook/profiler/matchers`
107+
* :doc:`/cookbook/profiler/storage`
107108

108109
* :doc:`/cookbook/request/index`
109110

cookbook/profiler/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Profiler
66

77
data_collector
88
matchers
9+
storage

cookbook/profiler/storage.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.. index::
2+
single: Profiling; Storage Configuration
3+
4+
Switching the Profiler Storage
5+
==============================
6+
7+
By default the profile stores the collected data in a file in the cache directory.
8+
You can control the storage being used through the ``dsn``, ``username``,
9+
``password`` and ``lifetime`` options. For example, the following configuration
10+
uses MySQL as the storage for the profiler with a lifetime of one hour:
11+
12+
.. configuration-block::
13+
14+
.. code-block:: yaml
15+
16+
# app/config/config.yml
17+
framework:
18+
profiler:
19+
dsn: "mysql:host=localhost;dbname=%database_name%"
20+
username: "%database_user%"
21+
password: "%database_password%"
22+
lifetime: 3600
23+
24+
.. code-block:: xml
25+
26+
<!-- app/config/config.xml -->
27+
<?xml version="1.0" encoding="UTF-8" ?>
28+
<container xmlns="http://symfony.com/schema/dic/services"
29+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
30+
xmlns:framework="http://symfony.com/schema/dic/symfony"
31+
xsi:schemaLocation="http://symfony.com/schema/dic/services
32+
http://symfony.com/schema/dic/services/services-1.0.xsd
33+
http://symfony.com/schema/dic/symfony
34+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
35+
>
36+
<framework:config>
37+
<framework:profiler
38+
dsn="mysql:host=localhost;dbname=%database_name%"
39+
username="%database_user%"
40+
password="%database_password%"
41+
lifetime="3600"
42+
/>
43+
</framework:config>
44+
</container>
45+
46+
.. code-block:: php
47+
48+
// app/config/config.php
49+
50+
// ...
51+
$container->loadFromExtension('framework', array(
52+
'profiler' => array(
53+
'dsn' => 'mysql:host=localhost;dbname=%database_name%',
54+
'username' => '%database_user',
55+
'password' => '%database_password%',
56+
'lifetime' => 3600,
57+
),
58+
));
59+
60+
The :doc:`HttpKernel component </components/http_kernel/introduction>` currently
61+
supports the following profiler storage implementations:
62+
63+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage`
64+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage`
65+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage`
66+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage`
67+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage`
68+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage`
69+
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage`

0 commit comments

Comments
 (0)