8000 [#2785] Minor tweaks to new profiler matchers docs · dunglas/symfony-docs@826197b · GitHub
[go: up one dir, main page]

Skip to content

Commit 826197b

Browse files
committed
[symfony#2785] Minor tweaks to new profiler matchers docs
1 parent 1adc399 commit 826197b

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

cookbook/profiler/matchers.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
.. index::
22
single: Profiling; Matchers
33

4-
How to use Matchers to enable the Profiler
5-
==========================================
4+
How to use Matchers to enable the Profiler Conditionally
5+
========================================================
66

77
By default, the profiler is only activated in the development environment. But
8-
it's imaginable that a developer always wants to see the profiler, even in
9-
production. Another situation may be to show the profiler when an admin has
10-
logged in. You can enable the profiler in these situations by using matchers.
8+
it's imaginable that a developer may want to see the profiler even in
9+
production. Another situation may be that you want to show the profiler only
10+
when an admin has logged in. You can enable the profiler in these situations
11+
by using matchers.
1112

12-
Using the build-in Matcher
13+
Using the built-in Matcher
1314
--------------------------
1415

1516
Symfony2 provides a
16-
:class:`build-in matcher <Symfony\\Component\\HttpFoundation\\RequestMatcher>`
17-
which can match paths and IPs. For instance, only show the profiler when
18-
accessing the page with the ``168.0.0.1`` ip. Then, the profiler can be
19-
configured to something like this:
17+
:class:`built-in matcher <Symfony\\Component\\HttpFoundation\\RequestMatcher>`
18+
which can match paths and IPs. For example, if you want to only show the
19+
profiler when accessing the page with the ``168.0.0.1`` ip, then you can
20+
use this configuration:
2021

2122
.. configuration-block::
2223

@@ -48,7 +49,7 @@ configured to something like this:
4849
));
4950
5051
You can also set a ``path`` option to define the path on which the profiler
51-
should be enabled. For instance, setting it to `^/admin/` will enable the
52+
should be enabled. For instance, setting it to ``^/admin/`` will enable the
5253
profiler only for the ``/admin/`` urls.
5354

5455
Creating a Custom Matcher
@@ -60,8 +61,8 @@ which implements
6061
:class:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface`. This
6162
interface requires one method:
6263
:method:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface::matches`.
63-
This method returns a falsey value to disable the profiler, any other value
64-
enables the profiler.
64+
This method returns false to disable the profiler and true to enable the
65+
profiler.
6566

6667
To enable the profiler when a ``ROLE_SUPER_ADMIN`` is logged in, you can use
6768
something like::

0 commit comments

Comments
 (0)
0