10000 minor #8685 Updated the profiler/* articles to Symfony 4 (javiereguil… · symfony/symfony-docs@011740b · GitHub
[go: up one dir, main page]

Skip to content

Commit 011740b

Browse files
committed
minor #8685 Updated the profiler/* articles to Symfony 4 (javiereguiluz, weaverryan)
This PR was merged into the master branch. Discussion ---------- Updated the profiler/* articles to Symfony 4 Commits ------- a2cd1fc changing order f769069 Updated the profiler/* articles to Symfony 4
2 parents 4d5ebc4 + a2cd1fc commit 011740b

File tree

4 files changed

+24
-37
lines changed

4 files changed

+24
-37
lines changed

profiler.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Profiler
33

44
.. toctree::
55
:maxdepth: 1
6-
:glob:
76

8-
profiler/*
7+
profiler/data_collector
8+
profiler/profiling_data
9+
profiler/matchers
10+
profiler/storage

profiler/data_collector.rst

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ block and set the value of two variables called ``icon`` and ``text``:
122122
{% block toolbar %}
123123
{% set icon %}
124124
{# this is the content displayed as a panel in the toolbar #}
125-
<span class="icon"><img src="..." alt=""/></span>
126-
<span class="sf-toolbar-status">Request</span>
125+
<svg xmlns="http://www.w3.org/2000/svg"> ... </svg>
126+
<span class="sf-toolbar-value">Request</span>
127127
{% endset %}
128128

129129
{% set text %}
@@ -147,23 +147,15 @@ block and set the value of two variables called ``icon`` and ``text``:
147147

148148
.. tip::
149149

150-
Built-in collector templates define all their images as embedded base64-encoded
151-
images. This makes them work everywhere without having to mess with web assets
152-
links:
153-
154-
.. code-block:: html
155-
156-
<img src="data:image/png;base64,..." />
157-
158-
Another solution is to define the images as SVG files. In addition to being
159-
resolution-independent, these images can be easily embedded in the Twig
160-
template or included from an external file to reuse them in several templates:
150+
Built-in collector templates define all their images as embedded SVG files.
151+
This makes them work everywhere without having to mess with web assets links:
161152

162153
.. code-block:: twig
163154
164-
{{ include('data_collector/icon.svg') }}
165-
166-
You are encouraged to use the latter technique for your own toolbar panels.
155+
{% set icon %}
156+
{{ include('data_collector/icon.svg') }}
157+
{# ... #}
158+
{% endset %}
167159
168160
If the toolbar panel includes extended web profiler information, the Twig template
169161
must also define additional blocks:
@@ -174,8 +166,7 @@ must also define additional blocks:
174166

175167
{% block toolbar %}
176168
{% set icon %}
177-
<span class="icon"><img src="..." alt=""/></span>
178-
<span class="sf-toolbar-status">Request</span>
169+
{# ... #}
179170
{% endset %}
180171

181172
{% set text %}
@@ -275,6 +266,5 @@ to specify a tag that contains the template:
275266
))
276267
;
277268
278-
The position of each panel in the toolbar is determined by the priority defined
279-
by each collector. Most built-in collectors use ``255`` as their priority. If you
280-
want your collector to be displayed before them, use a higher value (like 300).
269+
The position of each panel in the toolbar is determined by the collector priority
270+
(the higher the priority, the earlier the panel is displayed in the toolbar).

profiler/profiling_data.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Using this token, you can access the profile of any past response thanks to the
2121
:method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::loadProfile` method::
2222

2323
$token = $response->headers->get('X-Debug-Token');
24-
$profile = $container->get('profiler')->loadProfile($token);
24+
$profile = $profiler->loadProfile($token);
2525

2626
.. tip::
2727

@@ -34,14 +34,13 @@ The ``profiler`` service also provides the
3434
look for tokens based on some criteria::
3535

3636
// get the latest 10 tokens
37-
$tokens = $container->get('profiler')->find('', '', 10, '', '', '');
37+
$tokens = $profiler->find('', '', 10, '', '', '');
3838

3939
// get the latest 10 tokens for all URL containing /admin/
40-
$tokens = $container->get('profiler')->find('', '/admin/', 10, '', '', '');
40+
$tokens = $profiler->find('', '/admin/', 10, '', '', '');
4141

4242
// get the latest 10 tokens for local POST requests
43-
$tokens = $container->get('profiler')->find('127.0.0.1', '', 10, 'POST', '', '');
43+
$tokens = $profiler->find('127.0.0.1', '', 10, 'POST', '', '');
4444

4545
// get the latest 10 tokens for requests that happened between 2 and 4 days ago
46-
$tokens = $container->get('profiler')
47-
->find('', '', 10, '', '4 days ago', '2 days ago');
46+
$tokens = $profiler->find('', '', 10, '', '4 days ago', '2 days ago');

profiler/storage.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,22 @@
44
Switching the Profiler Storage
55
==============================
66

7-
In Symfony versions prior to 3.0, profiles could be stored in files, databases,
8-
services like Redis and Memcache, etc. Starting from Symfony 3.0, the only storage
9-
mechanism with built-in support is the filesystem.
10-
11-
By default the profile stores the collected data in the ``%kernel.cache_dir%/profiler/``
7+
The profiler stores the collected data in the ``%kernel.cache_dir%/profiler/``
128
directory. If you want to use another location to store the profiles, define the
139
``dsn`` option of the ``framework.profiler``:
1410

1511
.. configuration-block::
1612

1713
.. code-block:: yaml
1814
19-
# app/config/config.yml
15+
# config/packages/dev/web_profiler.yaml
2016
framework:
2117
profiler:
2218
dsn: 'file:/tmp/symfony/profiler'
2319
2420
.. code-block:: xml
2521
26-
<!-- app/config/config.xml -->
22+
<!-- config/packages/dev/web_profiler.xml -->
2723
<?xml version="1.0" encoding="UTF-8" ?>
2824
<container xmlns="http://symfony.com/schema/dic/services"
2925
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -40,7 +36,7 @@ directory. If you want to use another location to store the profiles, define the
4036
4137
.. code-block:: php
4238
43-
// app/config/config.php
39+
// config/packages/dev/web_profiler.php
4440
4541
// ...
4642
$container->loadFromExtension('framework', array(

0 commit comments

Comments
 (0)
0