Download the PHP package alchemy/binary-driver without Composer
On this page you can find all versions of the php package alchemy/binary-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package binary-driver
Binary Driver
Binary-Driver is a set of PHP tools to build binary drivers.
Why ?
You may wonder Why building a library while I can use exec
or
symfony/process ?.
Here is a simple answer :
-
If you use
exec
,passthru
,system
,proc_open
or any low level process handling in PHP, you should have a look to symfony/process component that will provide an OO portable, testable and secure interface to deal with this. It seems easy at first approach, but if you look at this component unit tests, you will see that handling process in a simple interface can easily become a nightmare. - If you already use symfony/process, and want to build binary drivers, you will always have the same common set of methods and objects to configure, log, debug, and generate processes. This library is a base to implement any binary driver with this common set of needs.
AbstractBinary
AbstractBinary
provides an abstract class to build a binary driver. It implements
BinaryInterface
.
Implementation example :
Binary detection troubleshooting
If you are using Nginx with PHP-fpm, executable detection may not work because of an empty $_ENV['path']
.
To avoid having an empty PATH
environment variable, add the following line to your fastcgi_params
config file (replace /your/current/path/
with the output of printenv PATH
) :
Logging
You can log events with a Psr\Log\LoggerInterface
by passing it in the load
method as second argument :
Listeners
You can add custom listeners on processes.
Listeners are built on top of Evenement
and must implement Alchemy\BinaryDriver\ListenerInterface
.
Bundled listeners
The debug listener is a simple listener to catch stderr
and stdout
outputs ;
read the implementation for customization.
ProcessBuilderFactory
ProcessBuilderFactory ease spawning processes by generating Symfony [Process] (http://symfony.com/doc/master/components/process.html) objects.
Configuration
A simple configuration object, providing an ArrayAccess
and IteratorAggregate
interface.
Same example using the ArrayAccess
interface :
License
This project is released under the MIT license.
All versions of binary-driver with dependencies
evenement/evenement Version ^3.0|^2.0|^1.0
psr/log Version ^1.0
symfony/process Version ^2.3|^3.0|^4.0|^5.0