A One-Liner Every PHP Engineer Should Run
This is the ultimate one-liner from hiraku-san that makes everyone happy.
1 | $ composer config -g repositories.packagist composer http://packagist.jp |
Installing with composer becomes dramatically faster.
The reason it’s slow is apparently that packagist.org is located in France.
A Problem Arises
Let’s run the one-liner above right away!!
And then…
1 | You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug |
It’s complaining that xdebug is enabled…
Finding Where xdebug Is Configured
1 | $ php -i | grep xdebug |
It was configured in /etc/php.d/xdebug.ini.
Note: depending on your environment, it may be configured in php.ini, etc., so be careful.
Changing the xdebug Setting to disabled
Since I had no need to use xdebug in my own PHP runtime environment,
I moved /etc/php.d/xdebug.ini out of the way:
1 | mv /etc/php.d/xdebug.ini /etc/php.d/xdebug.ini.org |
Running Again
Huh… it showed up again… This time:
1 | Do not run Composer as root/super user! See https://getcomposer.org/root for details |
It’s complaining that I shouldn’t run it as the root user…
Switching to a Regular User Instead of root
1 | # su - <user> |
Running Again
Success!
1 | $ composer config -g repos.packagist composer https://packagist.jp |
Verifying the Configuration
Confirm that the packagist url is now https://packagist.jp:
1 | $ cat .composer/config.json |
Enjoy a good PHP life!

