-
-
Notifications
You must be signed in to change notification settings - Fork 387
Debugging Components: Info for PHP #2526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3715,6 +3715,11 @@ Debugging Components | |
Need to list or debug some component issues. | ||
The `Twig Component debug command`_ can help you. | ||
|
||
To debug your PHP code, you can inject a `private LoggerInterface $logger` in your `__construct`. | ||
Then you can use `$this->logger->debug('Message', ['var' => $var]);` and see the output in `var/log/dev.log`. | ||
`dump` won't display anything anywhere (not even the debug toolbar). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not true. During the first render, dumps are shown either in the template or in the debug toolbar. On following request they are shown on the profiler, like any AJAX request. |
||
`dd` will display in your browser, but will also deadlock your component - you cannot dismiss it and continue working. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same thing in a webpage. |
||
|
||
Test Helper | ||
----------- | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is really needed, as it applies to any component / service in Symfony apps (and you can inject a Logger with a lot of other methods,) .
We could send the user towards the documentation pages on logging, but then it would not be really about debugging.