Skip to content

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

Merged
merged 1 commit into from
Jan 30, 2015
Merged

Global dump #4883

merged 1 commit into from
Jan 30, 2015

Conversation

nicolas-grekas
Copy link
Member

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.
Copy link
Member

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.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks


#. Run ``composer global require symfony/var-dumper``;
#. Add ``auto_prepend_file = ${HOME}/.composer/vendor/autoload.php``
to your ``php.ini`` file;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

@wouterj
Copy link
Member

wouterj commented Jan 19, 2015

Looks like a very nice tip to add to the documentation! :)

@lyrixx
Copy link
Member

lyrixx commented Jan 19, 2015

👍

.. tip::

In order to have the ``dump()`` function always available, you can install
it globally in your dev environment:
Copy link
Member

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:

Copy link
Member

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"?

Copy link
Member

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.

@nicolas-grekas
Copy link
Member Author

Thanks for the comments guys, PR updated. Ok for you?

@stof
Copy link
Member

stof commented Jan 19, 2015

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
Copy link
Member

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)

Copy link
Member Author

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 ;-) )

Copy link
Member

Choose a reason for hiding this comment

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

Okay, you won. 👍 then :)

@wouterj
Copy link
Member

wouterj commented Jan 19, 2015

@stof that's exactly what I was thinking. Or maybe we have to recommend to add $HOME/.composer/vendor/symfony/var-dumper/Resources/functions/dump.php as auto prepend file.

(or create a custom auto prepend file in the PHP dir which requires this one)

@nicolas-grekas
Copy link
Member Author

@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).
This just works (c)

@nicolas-grekas
Copy link
Member Author

For the reader wondering about autoloading precedence, global classes are always looked up after project classes. So, the project always takes precedence.

@Pierstoval
Copy link
Contributor

Absolutely awesome, I've just installed it and it works like a charm, this is REALLY great ! :)

@weaverryan
Copy link
Member

@nicolas-grekas how did you know that I was wondering about autoloading precedence? :) Because of that, I like this.

Thanks!

@weaverryan weaverryan merged commit 4121dbd into symfony:2.6 Jan 30, 2015
weaverryan added a commit that referenced this pull request Jan 30, 2015
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
@nicolas-grekas nicolas-grekas deleted the global-dump branch March 23, 2015 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants