Wakeapp/supervisor-bundle

Symfony 扩展包,允许您使用 @Supervisor 注解来配置Supervisor如何运行您的命令。

这个包的官方仓库似乎已经消失,因此该包已被冻结。

安装次数: 1,367

依赖者: 1

建议者: 0

安全: 0

星标: 1

关注者: 6

分支: 0

开放问题: 0

类型:symfony-bundle

v1.2.0 2021-04-29 16:48 UTC

This package is auto-updated.

Last update: 2024-02-29 03:50:49 UTC


README

简介

此包允许使用任何类来描述监督器的配置。

安装

步骤 1: 下载包

打开控制台,进入项目目录,执行以下命令以下载此包的推荐稳定版本:

    composer require wakeapp/supervisor-bundle

此命令假定已经全局安装并可用 Composer

步骤 2: 连接包

之后,通过将其添加到项目中的 app/AppKernel.php 文件中的注册包列表来启用此包。

<?php declare(strict_types=1);
// app/AppKernel.php

class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = [
            // ...

            new Wakeapp\Bundle\SupervisorBundle\WakeappSupervisorBundle(),
        ];

        return $bundles;
    }

    // ...
}

配置

要开始使用此包,不需要预先配置,默认值如下:

wakeapp_supervisor:
    exporter:
        # Supervisor program options могут быть описаны в этом блоке
        program:
            autostart: 'true'
        
        # allows you to specify a program that all commands should be passed to
        executor: php 
        
        # allows you to specify the console that all commands should be passed to
        console: app/console

    # список директорий, в которых будет происходить поиск классов, реализующих аннотацию @Supervisor
    source_directories:
        - 'src'

使用

<?php declare(strict_types=1);

namespace Acme;

use Symfony\Component\Console\Command\Command;
use Wakeapp\Bundle\SupervisorBundle\Annotation\Supervisor;

/**
 * @Supervisor(processes=3, commandName="namespace:command", params="--send", delayBefore=3, delayAfter=5, server="web")
 */
class AcmeCommand extends Command
{
}

许可证

license