indigophp/supervisor-configuration

此包已被废弃,不再维护。作者建议使用 supervisorphp/configuration 包。

使用PHP管理Supervisor配置

v0.1.0 2015-01-04 00:34 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:43:05 UTC


README

弃用通知

此包已移至SupervisorPHP。

https://github.com/supervisorphp/configuration

详细信息请见 http://supervisorphp.com

Indigo Supervisor Configuration

Latest Version Software License Build Status Code Coverage Quality Score HHVM Status Total Downloads Dependency Status

使用PHP管理Supervisor配置。

安装

通过Composer

$ composer require indigophp/supervisor-configuration

使用方法

使用构建器创建配置。

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);

本包中包含以下部分:

  • Supervisord
  • Supervisorctl
  • UnixHttpServer
  • InetHttpServer
  • 包含**
  • *
  • 程序*
  • 事件监听器*
  • FastCGI程序*

*注意:这些部分需要使用名称实例化,可选地还可以使用属性数组。

$section = new Program('test', ['command' => 'cat']);

**注意:PHP中关键字 include 是保留的,因此类名为 Includes,但部分名称仍为 include

现有配置

您可以解析您的现有配置,并将其用作 Configuration 对象。

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);

可用解析器

编写配置

您可以使用 Writer 将配置写入各种目的地。

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);

可用写入器

有关每个部分的属性详细信息,请参阅:http://supervisord.org/configuration.html

测试

$ phpspec run

贡献

请参阅 CONTRIBUTING 了解详细信息。

致谢

许可

MIT许可(MIT)。有关更多信息,请参阅 许可文件