orkestra/daemon
最新稳定版本:1.0.0
Composer 安装命令:
composer require orkestra/daemon
包简介
Run PHP scripts as a background daemon
README 文档
README
Daemonize your PHP scripts to accomplish work in the background.
Note: This library requires that you install the Process Control and POSIX extensions.
Installation
The easiest way to add orkestra-common to your project is using composer.
Add orkestra-common to your composer.json file:
{
"require": {
"orkestra/daemon": "dev-master"
}
}
Then run composer install or composer update.
Usage
Spawning a new worker process using pcntl_exec:
<?php require __DIR__ . '/vendor/autoload.php'; use Orkestra\Daemon\Daemon; use Orkestra\Daemon\Worker\PcntlWorker; $daemon = new Daemon(); $daemon->addWorker(new PcntlWorker('/path/to/executable', array('--arg=value'))); $daemon->execute();
Spawning a worker processing using a Symfony Process:
<?php require __DIR__ . '/vendor/autoload.php'; use Orkestra\Daemon\Daemon; use Orkestra\Daemon\Worker\ProcessWorker; use Symfony\Component\Process\Process; $process = new Process('/path/to/executable --arg=value'); $daemon = new Daemon(); $daemon->addWorker(new ProcessWorker($process)); $daemon->execute();
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-31