8000 Merge branch '3.4' · symfony/symfony-docs@72fc15d · GitHub
[go: up one dir, main page]

Skip to content

Commit 72fc15d

Browse files
committed
Merge branch '3.4'
* 3.4: Showing the new debug:autowiring command Remove outdated performance tips
2 parents 6ab2689 + 2b3d5f1 commit 72fc15d

File tree

4 files changed

+7
-86
lines changed

4 files changed

+7
-86
lines changed

controller.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ If you need a service in a controller, just type-hint an argument with its class
268268

269269
Awesome!
270270

271-
What other services can you type-hint? To see them, use the ``debug:container`` console
271+
What other services can you type-hint? To see them, use the ``debug:autowiring`` console
272272
command:
273273

274274
.. code-block:: terminal
275275
276-
$ php bin/console debug:container --types
276+
$ php bin/console debug:autowiring
277277
278278
If you need control over the *exact* value of an argument, you can override your
279279
controller's service config:

performance.rst

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ value too using the ``realpath_cache_ttl`` option:
9696
Use Composer's Class Map Functionality
9797
--------------------------------------
9898

99-
By default, the Symfony Standard Edition uses Composer's autoloader
100-
in the `autoload.php`_ file. This autoloader is easy to use, as it will
99+
Symfony uses Composer's autoloader. This autoloader is easy to use, as it will
101100
automatically find any new classes that you've placed in the registered
102101
directories.
103102

@@ -125,82 +124,6 @@ your deploy process:
125124
Prevents Composer from scanning the file system for classes that are not
126125
found in the class map.
127126

128-
Caching the Autoloader with APC
129-
-------------------------------
130-
131-
Another solution is to cache the location of each class after it's located
132-
the first time. Symfony comes with a class - :class:`Symfony\\Component\\ClassLoader\\ApcClassLoader` -
133-
that does exactly this. To use it, just adapt your front controller file.
134-
If you're using the Standard Distribution, make the following changes::
135-
136-
// app.php
137-
// ...
138-
139-
use Symfony\Component\ClassLoader\ApcClassLoader;
140-
141-
// do not use $loader as a variable name here as it would
142-
// be overwritten when loading the bootstrap.php.cache file
143-
$classLoader = require __DIR__.'/../app/autoload.php';
144-
include_once __DIR__.'/../app/bootstrap.php.cache';
145-
146-
// Use APC for autoloading to improve performance
147-
// Change 'sf2' by the prefix you want in order
148-
// to prevent key conflict with another application
149-
$loader = new ApcClassLoader('sf2', $classLoader);
150-
$loader->register(true);
151-
152-
// ...
153-
154-
For more details, see :doc:`/components/class_loader/cache_class_loader`.
155-
156-
.. note::
157-
158-
When using the APC autoloader, if you add new classes, they will be found
159-
automatically and everything will work the same as before (i.e. no
160-
reason to "clear" the cache). However, if you change the location of a
161-
particular namespace or prefix, you'll need to flush your APC cache. Otherwise,
162-
the autoloader will still be looking at the old location for all classes
163-
inside that namespace.
164-
165-
.. index::
166-
single: Performance; Bootstrap files
167-
168-
Use Bootstrap Files
169-
-------------------
170-
171-
To ensure optimal flexibility and code reuse, Symfony applications leverage
172-
a variety of classes and 3rd party components. But loading all of these classes
173-
from separate files on each request can result in some overhead. To reduce
174-
this overhead, the Symfony Standard Edition provides a script to generate
175-
a so-called `bootstrap file`_, consisting of multiple classes definitions
176-
in a single file. By including this file (which contains a copy of many of
177-
the core classes), Symfony no longer needs to include any of the source files
178-
containing those classes. This will reduce disc IO quite a bit.
179-
180-
If you're using the Symfony Standard Edition, then you're probably already
181-
using the bootstrap file. To be sure, open your front controller (usually
182-
``app.php``) and check to make sure that the following line exists::
183-
184-
include_once __DIR__.'/../var/bootstrap.php.cache';
185-
186-
Note that there are two disadvantages when using a bootstrap file:
187-
188-
* the file needs to be regenerated whenever any of the original sources change
189-
(i.e. when you update the Symfony source or vendor libraries);
190-
191-
* when debugging, one will need to place break points inside the bootstrap file.
192-
193-
If you're using the Symfony Standard Edition, the bootstrap file is automatically
194-
rebuilt after updating the vendor libraries via the ``composer install`` command.
195-
196-
Bootstrap Files and Byte Code Caches
197-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198-
199-
Even when using a byte code cache, performance will improve when using a bootstrap
200-
file since there will be fewer files to monitor for changes. Of course, if this
201-
feature is disabled in the byte code cache (e.g. ``apc.stat=0`` in APC), there
202-
is no longer a reason to use a bootstrap file.
203-
204127
Learn more
205128
----------
206129

@@ -213,5 +136,3 @@ Learn more
213136
.. _`APC`: http://php.net/manual/en/book.apc.php
214137
.. _`APCu Polyfill component`: https://github.com/symfony/polyfill-apcu
215138
.. _`APCu PHP functions`: http://php.net/manual/en/ref.apcu.php
216-
.. _`autoload.php`: https://github.com/symfony/symfony-standard/blob/master/app/autoload.php
217-
.. _`bootstrap file`: https://github.com/sensiolabs/SensioDistributionBundle/blob/master/Composer/ScriptHandler.php

service_container.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ type-hints by running:
323323

324324
.. code-block:: terminal
325325
326-
$ php bin/console debug:container --types
326+
$ php bin/console debug:autowiring
327327
328328
This is just a small subset of the output:
329329

service_container/debug.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ To see a list of all of the available types that can be used for autowiring, run
2222

2323
.. code-block:: terminal
2424
25-
$ php bin/console debug:container --types
25+
$ php bin/console debug:autowiring
2626
27-
.. versionadded:: 3.3
28-
The ``--types`` option was introduced in Symfony 3.3.
27+
.. versionadded:: 3.4
28+
The ``debug:autowiring`` command was introduced in Symfony 3.3.
2929

3030
Detailed Info about a Single Service
3131
------------------------------------

0 commit comments

Comments
 (0)
0