微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SLOW COMPOSER ON OS X?

If your composer install is painfully slow, then this might be the fix for you.  I got to a point where it was taking a REALLY long time to run simple updates using PHP 5.6.15.  Sure sure, PHP7 is around the corner, but I Couldn't sacrifice my dev environment which reflects our deploy requirements.

FirsT, HOMEBREW

If you don't have Homebrew on your machine, well, it's never too late to do the right thing.  You can get more details at http://brew.sh.  Installation is simple:

Bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

THEN, HHVM

If you aren't familiar with HHVM, it's all here: http://hhvm.com.  Essentially, it was a turbocharged PHP created by the folks at Facebook.  They did excellent work to be honest, and the performance gains were staggering. Performance differences between PHP7 and HHVM were certainly the elePHPhant in the room.

Get HHVM installed with Homebrew like so:

Bash
brew tap hhvm/hhvm
brew install hhvm

That one will take awhile.  Go Netflix'n'chill for a few and check it when you're "done".

 

LAST, COMPOSER ALIAS

This part is very simple.  You just need to create an alias in your ~/.bash_profile file.  If it doesn't exist, create it.  From Terminal, issue this command:

Bash
pico ~/.bash_profile

Then, add this alias into it

Bash
alias composer="hhvm -v ResourceLimit.socketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar"

Hit CTRL+X, answer Yes to save, and then refresh your session with:

Bash
source ~/.bash_profile

That's it!  You should be able to head into your composer project and issue a magical composer update that's 10 times faster than its ever been!

Let me kNow how things pan out!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐