@@ -6,13 +6,13 @@ How to Use Matchers to Enable the Profiler Conditionally
66
77The Symfony profiler is only activated in the development environment to not hurt
88your 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
1010issues. This behavior is implemented with the **Request Matchers **.
1111
1212Using the built-in Matcher
1313--------------------------
1414
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
1616matches a set of conditions. Symfony provides a
1717:class: `built-in matcher <Symfony\\ Component\\ HttpFoundation\\ RequestMatcher> `
1818which matches paths and IPs. For example, if you want to only show the profiler
@@ -33,16 +33,27 @@ configuration:
3333 .. code-block :: xml
3434
3535 <!-- 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 >
4151
4252 .. code-block :: php
4353
4454 // app/config/config.php
4555 $container->loadFromExtension('framework', array(
56+ // ...
4657 'profiler' => array(
4758 'ip' => '168.0.0.1',
4859 ),
@@ -145,12 +156,21 @@ profiler to use this service as the matcher:
145156 .. code-block :: xml
146157
147158 <!-- 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 >
154174
155175 .. code-block :: php
156176
0 commit comments