Skip to content

Spoon-fed process forking for PHP.

License

Notifications You must be signed in to change notification settings

bigcommerce/php-spork

 
 

Repository files navigation

Spork

Build Status

Spoon-fed process forking for PHP.

I got sick of writing the same process fork-and-check pattern over and over and so I made Spork.

Use Spork\Process::parent in a control structure to access the parent process when a child is successfully forked. In all other cases—including when pcntl is not available—the FALSE case can be used instead.

I'm sure there's already another PHP project named Spork somewhere out there, but I don't expect this to get a wide audience.

Example

if (Spork\Process::parent($child_pid, $forked)) {
    // this is the parent process with $child_pid populated
} else {
    // this is the child process, or forking failed
    // forking success or failure can be seen with $forked
}

Both the arguments are optional.

About

Spoon-fed process forking for PHP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%