PHP on the CLI is only an interpreter. Thus, it is capable of evaluating commands and scripts. But, it can't let you pile up commands and spit out their results line by line. It has no REPL capabilities. And what?
REPL makes easy to check some aspect of a language. It lets you play with a language before coding your programs. Having this tool alongside prevents you from writing a ton of scriptlets just to check or enhance your development or improve your syntax.
Thankfully, here comes Boris. It is the REPL that PHP should have from its early days.
Installing it on OSX with Homebrew is easy as pie and is performed with these simple steps:
- Start by installing some new recipes (or formulas):
brew tap josegonzalez/homebrew-php
- Then, install a local PHP interpreter. I prefer installing the 5.4 release as it matches the one provided with OSX but you can experiment with other if you plan on mimicking one of your servers in production:
brew install php54
Note: If you haven't done it before, Homebrew may warn you that a zlib dependencies is not met. In this case, follow his advice by running the following command and re-running the former one:brew tap homebrew/dupes
- Now, you should have a local PHP available. It is time to add a decent package management for it, Composer:
brew install josegonzalez/php/composer
- And, now, let us invite Boris to the party:
brew install boris
Use
boris
as any of your regular commands like any regular REPL in your Terminal or iTerm2 or whatever CLI you like.
Aucun commentaire:
Enregistrer un commentaire