vielhuber/parallyzer

一个用于运行多个非阻塞(php-)脚本的穷人的PHP工具。

1.0.6 2019-07-15 12:40 UTC

This package is auto-updated.

Last update: 2024-09-16 00:50:15 UTC


README

parallyzer是一个穷人的PHP工具,用于在单独的CPU线程中运行多个非阻塞(php-)脚本。

特性

  • 在Linux和mac上运行
  • 无需像pthreads这样的扩展
  • 运行PHP脚本或任何其他命令
  • 在定义的间隔中查看输出
  • 支持基于文件的输出日志

安装

composer require vielhuber/parallyzer
require __DIR__ . '/vendor/autoload.php';
use vielhuber\parallyzer\parallyzer;
$p = new parallyzer();

使用方法

$p->add('php test.php', 100); // adds the command "php test.php" in 100 parallel threads to the worker
$p->add('ls -s', 25); // adds the command "ls -s" in 25 parallel threads to the worker
$p->observe(1); // enables live observing with an update interval of 1 second
$p->log('logs'); // enables output logging in the folder "logs"
$p->run(); // runs the machinery