Skip to content

About

Class for running separate processes of PHP CLI scripts

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Script runner

Software License Build Status codecov Codacy Badge

Class for running PHP CLI script in several separate processes.

Requirements

  • PHP >= 7.1

Install

Use class as standalone:

require 'ScriptRunner.php';
use PhpStrict\ScriptRunner\ScriptRunner;

Install with Composer:

composer require php-strict/script-runner

Usage

use PhpStrict\ScriptRunner\ScriptRunner;

//params: path_to_script, processes count (if omitted then system CPU cores count will be used)
$sr = new ScriptRunner('script.php', 4);
$sr->run();

May be used with CooperativeWorker to split one sequential process into several separated processes and keep them from collisions and making the same job twice. For eaxample it is possible to convert process of parsing log files from cycle (where log files parsing one-by-one) into several separated processes where each process take job from common temporary storage (queue).

Tests

To execute the test suite, you'll need Codeception.

vendor/bin/codecept run

About

Class for running separate processes of PHP CLI scripts

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages