-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Global dump #4883
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
Global dump #4883
Conversation
nicolas-grekas
commented
Jan 19, 2015
Q | A |
---|---|
Doc fix? | no |
New docs? | yes |
Applies to | all |
Fixed tickets | - |
``composer global require symfony/var-dumper`` then add | ||
``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php`` | ||
to your ``php.ini`` file. Don't forget to run ``composer global update`` | ||
from time to time to keep up with the latest fixes. |
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 think it's more clear to put this in a step list:
.. tip::
In order to have to ``dump()`` function always available, you can install
it globally in your dev environment:
#. Run ``composer global require symfony/var-dumper``;
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php``
to your ``php.ini`` file;
#. (Don't forget to run ``composer global update`` from time to time to always
have the latest bug fixes.)
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.
Fixed, thanks
32f4e4a
to
c34ed68
Compare
|
||
#. Run ``composer global require symfony/var-dumper``; | ||
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php`` | ||
to your ``php.ini`` file; |
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.
Does PHP interpret environment variables in the php.ini
file? What happens when the file doesn't exist?
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.
- Yes it does: http://php.net/manual/en/configuration.file.php
- A fatal error
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.
Should we add a warning then? Otherwise, people could get these errors when they execute PHP scripts with different users.
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 think the error message is good enough to not clutter the doc, what do you think?
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. Will each and every beginner really understand that a global Composer installation is only global in regard of their user account? We should keep in mind that the web server might not be the same account as the one the developer is using.
Looks like a very nice tip to add to the documentation! :) |
👍 |
.. tip:: | ||
|
||
In order to have the ``dump()`` function always available, you can install | ||
it globally in your dev environment: |
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.
The phrase ... in your dev environment
may sound confusing. This has nothing to do with the dev
environment of Symfony applications. I would replace it by:
In order to have the ``dump()`` function available for any PHP script or application and not only for
your Symfony applications, you can install it globally in your machine:
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 do agree with you, but I also don't like the verbose thing you proposed. The docs are always a fight between making something easy to understand and keeping something as short as possible (especially when it's about simple tips like this).
What do you think about replacing "environment" with "machine" or "box"?
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.
It's true that my proposal is more verbose, but I think it explains the purpose of the tip better.
In the original text, what does "to have the function always available" mean? That's why I prefer to say explicitly that this is referring to using it outside Symfony applications.
And the same for dev environment
or dev box
. Prefer to say your machine
, your computer
, your local machine
, etc.
c34ed68
to
74e7450
Compare
Thanks for the comments guys, PR updated. Ok for you? |
74e7450
to
28e530c
Compare
28e530c
to
4121dbd
Compare
I see an issue with this proposal: the composer global project can contain lots of other stuff as well, which might create issues in your project. To do it in a safe way, you should do a composer installation where you only have the var-dumper component |
#. Run ``composer global require symfony/var-dumper``; | ||
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php`` | ||
to your ``php.ini`` file; | ||
#. From time to time, run ``composer global update`` to have the latest |
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.
@javiereguiluz and I concluded to put this after the list (not as a list item). If you agree, could you please do that? (I hope it's the last fix, as you've had to push way to many times for a simple tip like this)
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 prefer it with a 3d item (I talked last with @javiereguiluz offline, so I win ;-) )
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.
Okay, you won. 👍 then :)
@stof that's exactly what I was thinking. Or maybe we have to recommend to add (or create a custom auto prepend file in the PHP dir which requires this one) |
@stof lets document an easy way for new comers. Advanced users that know what they do with composer will find their way. New comers won't have many "composer global" things (it's not a very common thing, or you're an advanced user). |
For the reader wondering about autoloading precedence, global classes are always looked up after project classes. So, the project always takes precedence. |
Absolutely awesome, I've just installed it and it works like a charm, this is REALLY great ! :) |
@nicolas-grekas how did you know that I was wondering about autoloading precedence? :) Because of that, I like this. Thanks! |
This PR was merged into the 2.6 branch. Discussion ---------- Global dump | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | - Commits ------- 4121dbd [VarDumper] add a tip about global dump() availability