indigophp / supervisor-configuration
Manage Supervisor configuration in PHP
Requires
- php: >=5.4.0
- symfony/options-resolver: ~2.6.0
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: ~1.0.0
- league/flysystem: ~0.5.0
- phpspec/phpspec: ~2.1.0
Suggests
- league/flysystem: Used by Filesystem Parsers/Writers
This package is not auto-updated.
Last update: 2022-02-01 12:43:05 UTC
README
DEPRECATION NOTICE
This package has been moved under SupervisorPHP.
For details see http://supervisorphp.com
Indigo Supervisor Configuration
Manage Supervisor configuration in PHP.
Install
Via Composer
$ composer require indigophp/supervisor-configuration
Usage
Create a configuration using the builder.
use Indigo\Supervisor\Configuration; use Indigo\Supervisor\Configuration\Section\Supervisord; use Indigo\Supervisor\Configuration\Section\Program; use Indigo\Supervisor\Configuration\Renderer; $config = new Configuration; $renderer = new Renderer; $section = new Supervisord(['identifier' => 'supervisor']); $config->addSection($section); $section = new Program('test', ['command' => 'cat']); $config->addSection($section); echo $renderer->render($config);
The following sections are available in this pacakge:
- Supervisord
- Supervisorctl
- UnixHttpServer
- InetHttpServer
- Includes**
- Group*
- Program*
- EventListener*
- FcgiProgram*
*Note: These sections has to be instantiated with a name and optionally a properties array:
$section = new Program('test', ['command' => 'cat']);
**Note: The keyword include
is reserved in PHP, so the class name is Includes
, but the section name is still include
.
Existing configuration
You can parse your existing configuration, and use it as a Configuration
object.
use Indigo\Supervisor\Configuration; use Indigo\Supervisor\Configuration\Parser\File; $parser = new File('/etc/supervisor/supervisord.conf'); $configuration = new Configuration; // argument is optional, returns a new Configuration object if not passed $parser->parse($configuration);
Available parsers:
- File
- Filesystem (Using league/flysystem)
- Text
Writting configuration
You can use Writer
s to write configuration to various destinations.
use Indigo\Supervisor\Configuration; use Indigo\Supervisor\Configuration\Writer\File; // As a second parameter you can optionally pass an instance of Indigo\Supervisor\Configuration\Renderer $writer = new File('/etc/supervisor/supervisord.conf'); $configuration = new Configuration; $writer->write($configuration);
Available writers:
- File
- Filesystem (Using league/flysystem)
You can find detailed info about properties for each section here: http://supervisord.org/configuration.html
Testing
$ phpspec run
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.