@@ -6,13 +6,13 @@ How to Use Matchers to Enable the Profiler Conditionally
6
6
7
7
The Symfony profiler is only activated in the development environment to not hurt
8
8
your application performance. However, sometimes it may be useful to conditionally
9
- enable the profiler in the production environment to assist you in hard to debug
9
+ enable the profiler in the production environment to assist you in debugging
10
10
issues. This behavior is implemented with the **Request Matchers **.
11
11
12
12
Using the built-in Matcher
13
13
--------------------------
14
14
15
- A Request Matcher is a class that checks whether a given ``Request `` instance
15
+ A request matcher is a class that checks whether a given ``Request `` instance
16
16
matches a set of conditions. Symfony provides a
17
17
:class: `built-in matcher <Symfony\\ Component\\ HttpFoundation\\ RequestMatcher> `
18
18
which matches paths and IPs. For example, if you want to only show the profiler
@@ -33,16 +33,27 @@ configuration:
33
33
.. code-block :: xml
34
34
35
35
<!-- app/config/config.xml -->
36
- <framework : config >
37
- <framework : profiler
38
- ip =" 168.0.0.1"
39
- />
40
- </framework : config >
36
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
37
+ <container xmlns =" http://symfony.com/schema/dic/services"
38
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
39
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-Instance"
40
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
41
+ http://symfony.com/schema/dic/services/services-1.0.xsd
42
+ http://symfony.com/schema/dic/symfony
43
+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
44
+ >
45
+
46
+ <framework : config >
47
+ <!-- ... -->
48
+ <framework : profiler ip =" 168.0.0.1" />
49
+ </framework : config >
50
+ </container >
41
51
42
52
.. code-block :: php
43
53
44
54
// app/config/config.php
45
55
$container->loadFromExtension('framework', array(
56
+ // ...
46
57
'profiler' => array(
47
58
'ip' => '168.0.0.1',
48
59
),
@@ -145,12 +156,21 @@ profiler to use this service as the matcher:
145
156
.. code-block :: xml
146
157
147
158
<!-- app/config/config.xml -->
148
- <framework : config >
149
- <!-- ... -->
150
- <framework : profiler
151
- service =" app.super_admin_matcher"
152
- />
153
- </framework : config >
159
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
160
+ <container xmlns =" http://symfony.com/schema/dic/services"
161
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
162
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-Instance"
163
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
164
+ http://symfony.com/schema/dic/services/services-1.0.xsd
165
+ http://symfony.com/schema/dic/symfony
166
+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
167
+ >
168
+
169
+ <framework : config >
170
+ <!-- ... -->
171
+ <framework : profiler service =" app.super_admin_matcher" />
172
+ </framework : config >
173
+ </container >
154
174
155
175
.. code-block :: php
156
176
0 commit comments