Implementation of CommonJS Promises/A pattern for PHP