supervisorphp / configuration
管理 PHP 中的 Supervisor 配置
v0.3.0
2020-07-06 05:25 UTC
Requires
- php: >=7.3
- indigophp/ini: ^0.2
- symfony/options-resolver: ^2.6|^3.0|^4.0|^5.0
Requires (Dev)
- league/flysystem: ^1.0
- overtrue/phplint: ^2.0
- phpspec/phpspec: ^6.2
- phpstan/phpstan: ^0.12.32
- phpstan/phpstan-strict-rules: ^0.12.2
- roave/security-advisories: dev-master
Suggests
- league/flysystem: Allows reading and writing to many filesystems.
This package is auto-updated.
Last update: 2024-09-22 06:40:44 UTC
README
在 PHP 中管理 Supervisor 配置。
安装
通过 Composer
composer require supervisorphp/configuration
用法
使用构建器创建配置。
$config = new \Supervisor\Configuration\Configuration; $renderer = new \Indigo\Ini\Renderer; $section = new \Supervisor\Configuration\Section\Supervisord(['identifier' => 'supervisor']); $config->addSection($section); $section = new \Supervisor\Configuration\Section\Program('test', ['command' => 'cat']); $config->addSection($section); echo $renderer->render($config->toArray());
此包中可用的部分
- Supervisord
- Supervisorctl
- UnixHttpServer
- InetHttpServer
- 包含**
- 组*
- 程序*
- 事件监听器*
- FastCGI 程序*
*注意:这些部分需要通过名称实例化,并且可以选择性地提供一个属性数组
$section = new \Supervisor\Configuration\Section\Program('test', ['command' => 'cat']);
**注意:关键字 include
在 PHP 中是保留的,因此类名为 Includes
,但部分名称仍然是 include
。
现有配置
您可以解析您的现有配置,并将其用作 Configuration
对象。
$loader = new \Supervisor\Configuration\Loader\IniFileLoader('/etc/supervisor/supervisord.conf'); $configuration = $loader->load();
可用的加载器
IniFileLoader
FlysystemLoader
(使用 league/flysystem)IniStringLoader
编写配置
您可以使用 Writer
将配置写入各种目的地。
$configuration = new \Supervisor\Configuration\Configuration; // Modify configuration... $writer = new \Supervisor\Configuration\Writer\IniFileWriter('/etc/supervisor/supervisord.conf'); $writer->write($configuration);
可用的编写器
IniFileWriter
FlysystemWriter
(使用 league/flysystem)
有关每个部分的属性详细信息的详细信息,请参阅:http://supervisord.org/configuration.html
测试
composer ci
贡献
请参阅 CONTRIBUTING 以获取详细信息。
鸣谢
许可
MIT 许可证(MIT)。有关更多信息,请参阅 许可文件。