If you are a PHP developer who is still yet to hear about HHVM (HipHop Virtual Machine) then you must have been living under a rock for the last 2 years. HHVM is Facebook’s grand contribution back to the PHP community, providing up to 40x faster throughput on a standard WordPress site.
Whilst this is great for the PHP community, we are still waiting on 100% parity between the HHVM and the Zend Engine (which is the default PHP engine). In the meantime, enterprise frameworks such as Symfony and Doctrine’s ORM are out in the cold and cannot take advantage of HHVM. However, we can make use of HHVM for some of our day-to-day toolsets, and one of my most commonly used tools is PHPUnit.
Installing HHVM on Mac OSX is made easy by doing so via homebrew. We can install homebrew by following the instructions at the bottom of their homepage.
Next, we need to tap into some new brew repositories in order to install our HHVM. Run the following commands to do so:
Now our homebrew knows where to install HHVM from, we can tell it to do so:
HHVM can take a while to compile and install, so just be patient. It took about 45 minutes on my MacBook and will vary depending on your hardware.
We can verify the install by running the following command…
…and if all has gone smoothly we will see some output with the HHVM version number we currently have installed.
Now we can run our PHPUnit using HHVM (your path to PHPUnit might differ)…
We can go one step further and alias our PHPUnit (or whatever other tool you want to run) by adding the following to
…which will facilitate a new command
phpunit-hhvm allowing us to leave our original PHPUnit command running via the
standard PHP Zend Engine.