Skip to content
Prev Previous commit
Next Next commit
Fixes after great reviews
  • Loading branch information
wouterj committed Oct 7, 2017
commit 779983d42e22195f53f4e6e0a3e5e588d3e8b0c4
2 changes: 1 addition & 1 deletion configuration/front_controllers_and_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ to `decorate`_ the kernel with additional features. Examples include:
* Configuring the autoloader or adding additional autoloading mechanisms;
* Adding HTTP level caching by wrapping the kernel with an instance of
:ref:`AppCache <symfony-gateway-cache>`;
* Enabling (or skipping) the :doc:`ClassCache </debug/debugging>`;
* Enabling (or skipping) the :doc:`ClassCache </debug>`;
* Enabling the :doc:`Debug Component </components/debug>`.

The front controller can be chosen by requesting URLs like:
Expand Down
40 changes: 22 additions & 18 deletions debug.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
.. index::
single: Debugging

How to Optimize your Development Environment for Debugging
How to Optimize Your Development Environment for Debugging
==========================================================

When you work on a Symfony project on your local machine, you should use the
``dev`` environment (``app_dev.php`` front controller). This environment
configuration is optimized for two main purposes.
configuration is optimized for two main purposes:

* Give the developer accurate feedback whenever something goes wrong (provided
by the web debug toolbar, nice exception pages, profiler, ...);
* Be as similar as possible as the production environment to avoid problems
when deploying the project.
* Be as close as possible to the production environment to avoid problems when
deploying the project.

Using Interactive Debug Tools
-----------------------------

Interactive debug tools allow you to walk through the code step by step,
making it easier to indentify which step is causing problems. Symfony works
making it easier to identify which step is causing problems. Symfony works
with any PHP debug environment, among them:

* Xdebug_, the most well-known PHP debugger;
* PsySH_, a PHP REPL_ (Read-eval-print loop) debugger. Use the
FidryPsyshBundle_ for a dedicated Symfony integration of PsySH.
* `Xdebug`_, the most well-known PHP debugger;
* `PsySH`_, a PHP `REPL`_ (Read-eval-print loop) debugger. Use the
`FidryPsyshBundle`_ for a dedicated Symfony integration of PsySH.

Disabling the Bootstrap File and Class Caching
----------------------------------------------
Expand Down Expand Up @@ -60,8 +60,8 @@ below::

.. tip::

If you disable the PHP caches, don't forget to revert after your debugging
session.
If you disable the PHP caches, don't forget to revert these changes after
your debugging session.

Some IDEs do not like the fact that some classes are stored in different
locations. To avoid problems, you can either tell your IDE to ignore the PHP
Expand All @@ -74,8 +74,8 @@ Dumping Variables with the VarDumper

To ease the debugging of a variable in your application, you can use the
:doc:`VarDumper component </components/var_dumper>` to dump the content of a
variable. The component provides an alternative to the PHP :phpfunction:`var_dump()`
function, in the form of ``dump()``::
variable. The component provides the ``dump()`` function, an alternative to
PHP's :phpfunction:`var_dump()` function::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a not on how to install it or a link for it, as IIRC, unless the application is booted and if you forget to add the dump.php file in your composer.json, dump() won't work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section refers to the VarDumper component installation docs. I don't think we have to duplicate the info here.


// create a variable with a value
$myVar = ...;
Expand All @@ -86,7 +86,7 @@ function, in the form of ``dump()``::
The dumper is not limited to scalar values. Arrays and objects can also be
visualized using the VarDumper. One of the most important advantages of using
``dump()`` is a nicer and more specialized dump of objects (e.g. Doctrine
internals are filtered out when dumping a proxy entity).
internals are filtered out when dumping an entity proxy).

If the dumper is used on a command line, the result is a formatted string.
Otherwise, the result is a piece of HTML, which can be expanded to show nested
Expand All @@ -107,14 +107,14 @@ Useful Debugging Commands

When developing a large application, it can be hard to keep track of all the
different services, routes and translations. Luckily, Symfony has some commands
that can help you visualize and find the information.
that can help you visualize and find the information:

``debug:container``
Displays information about the contents of the Symfony container for all public
services. To find only those matching a name, append the name as an argument.
services. Append a service ID as an argument to find only those matching the ID.

``debug:config``
Shows all configured bundles, their class and their alias.
Shows all configured bundles, their classes and their aliases.

``debug:event-dispatcher``
Displays information about all the registered listeners in the event dispatcher.
Expand All @@ -123,15 +123,19 @@ that can help you visualize and find the information.
Displays information about all configured routes in the application as a
table with the name, method, scheme, host and path for each route.

``router:match <path_info>``
Shows the route information matching the provided path info or an error if
no route matches.

``debug:translation <locale>``
Shows a table of the translation key, the domain, the translation and the
fallback translation for all known messages, if translations exist for
fallback translation for all known messages if translations exist for
the given locale.

.. tip::

When in doubt how to use a console command, open the help section by
appending the ``--help`` option.
appending the ``--help`` (``-h``) option.

.. tip::

Expand Down