The Lesser-Known Contributors Who Are Trying To Make PHP Good Again
Composer is a pretty great package management system in the style of npm. It provides package management at the project level by providing a autoloader that is compiled on package install. This allows developers the ability to have multiple package versions installed on one machine and have them mapped to the projects they are specified for.
Furthermore, composer allows package maintainers a fresh start from the mess that is the Pear package manager.
A projects dependencies can be set up simply by including a composer.phar file and setting up a composer.json file like so:
One of the major reasons that ruby and python have become tremendously popular over the past five to ten years is because they provide very easy paths to test drive and maintain high coverage of your code base. The same cannot be said for PHP and its PhpUnit framework.
Phake is a mocking framework that aims to fix a lot of the problems that PhpUnit’s mocking framework introduces.
Simple mocking and stubbing in Phake has far less unnecessarily verbosity. Where a mock in PhpUnit requires this:
Phake only requires this:
Additionally, Phake provides a more sane solution to running verifies. In phpunit’s verify system you are required to state your verify before you state the code you’re testing. This makes the test much harder to read.
In Phake you are able to verify after your mock is injected like so:
3) Php 5.4 Additions:
There are several additions that have been made to php in 5.4 that provide tools that I am use to having access to in other web development environments. Namely, short syntax arrays, method chaining directly from an instantiated object and building a web server on the fly. Try some of these commands out:
Php still has its faults and there is likely little that can be done to erase them. But the developers of these new tools deserve some serious recognition for the work they are doing to move a language they love in the right direction.