dev-master
9999999-dev https://github.com/mtrunkat/php-libphutil-composerComposer compatible version (not official) of Libphutil library.
Apache licence
The Requires
- php >=5.3.0
futures libphutil
Composer compatible version (not official) of Libphutil library.
This is not offical port. I created this mainly to use Futures so the rest of the library may not work correctly., (*1)
Script that I use for conversion can be found here mtrunkat/php-libphutil-composer-convertor., (*2)
For more information about Libphutil check Github repository and official documentation., (*3)
Add this (Packagist) library into you composer.json:, (*4)
{ "require" : { "mtrunkat/lbphutil" : "dev-master" } }
And install it via php composer.phar install
or php composer.phar update
., (*5)
All the classes of original library are moved into Facebook\Libphutil namespace and each function [functionname] located in some file [filename].php is converted into static method Facebook\Libphutil\Functions[filename]::[functionname]., (*6)
So for example in original library you use Futures this way:, (*7)
<?php require_once 'path/to/libphutil/src/__phutil_library_init__.php'; $futures = array(); $futures['test a'] = new ExecFuture('ls'); $futures['test b'] = new ExecFuture('ls -l -a'); foreach (Futures($futures) as $dir => $future) { list($stdout, $stderr) = $future->resolvex(); print $stdout; }
But in Composer version of library you have to specify namespace for classes and convert functions into static methods:, (*8)
<?php require_once 'vendor/autoload.php'; use Facebook\Libphutil\ExecFuture; use Facebook\Libphutil\Functions\functions; $futures = array(); $futures['test a'] = new ExecFuture('ls'); $futures['test b'] = new ExecFuture('ls -l -a'); foreach (functions::Futures($futures) as $dir => $future) { list($stdout, $stderr) = $future->resolvex(); print $stdout; }
You can see that class ExecFuture in now in Facebook\Libphutil namespace and function Futures() originally located in file functions.php is now static method of class Facebook\Libphutil\Functions\functions., (*9)
Composer compatible version (not official) of Libphutil library.
Apache licence
futures libphutil