2017 © Pedro Peláez
 

library background-process

A small PHP library to run background processes

image

maxwellhealth/background-process

A small PHP library to run background processes

  • Monday, March 20, 2017
  • by maxwellhealth
  • Repository
  • 9 Watchers
  • 1 Stars
  • 8,171 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

background-process

Build Status, (*1)

A small PHP library to run background processes., (*2)

Basic Usage

From example.php:, (*3)

<?php

require_once 'vendor/autoload.php';

use BackgroundProcess\Process;

$pid = (new Process())
    ->withCommand('php tests/test-task.php')
    ->run();

echo 'Started process with PID ' . $pid . PHP_EOL;

user@host:~/background-process$ php example.php
Started process with PID 2129
user@host:~/background-process$ ps
  PID TTY           TIME CMD
 1706 ttys001    0:00.03 -bash
 2129 ttys001    0:00.03 php tests/test-task.php
user@host:~/background-process$

Capturing stdout and stderr

$pid = (new Process())
    ->withCommand('php tests/test-task.php')
    ->withStdoutFile('/tmp/stdout.log')
    ->withStderrFile('/tmp/stderr.log')
    ->run();

Writing to stdin

$pid = (new Process())
    ->withCommand('php tests/test-task.php')
    ->withInput('hello world!')
    ->run();

The Versions

20/03 2017

dev-master

9999999-dev

A small PHP library to run background processes

  Sources   Download

MIT

The Development Requires

20/03 2017

dev-tmpfile

dev-tmpfile

A small PHP library to run background processes

  Sources   Download

MIT

The Development Requires