Download the PHP package fast-forward/fork without Composer

On this page you can find all versions of the php package fast-forward/fork. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fork

Fast Forward Fork

A PHP 8.3+ library for orchestrating forked workers with typed signals, immutable worker groups, captured worker output, and PSR-3 logging.

PHP Version Composer Package Tests Coverage Docs GitHub Sponsors

fast-forward/fork wraps pcntl_fork() and related POSIX primitives in a small, strongly-typed API that is easier to reason about in real applications. It gives you a single manager for orchestration, explicit worker objects for lifecycle inspection, immutable worker groups for batch coordination, and a default signal handler that can shut everything down cleanly.

โœจ Features

๐Ÿ“ฆ Installation

Runtime requirements

The manager validates runtime support during construction. If the environment does not support forking safely, it throws FastForward\Fork\Exception\RuntimeException.

๐Ÿ› ๏ธ Usage

Basic usage

Wait for everything managed by the same manager

Read worker output before completion

Stop workers explicitly

Use the default signal handler

๐Ÿงฐ API Summary

Core classes

Class Responsibility Highlights
FastForward\Fork\Manager\ForkManager Master orchestration fork(), wait(), kill(), getMasterPid()
FastForward\Fork\Worker\Worker One forked worker PID, exit code, termination signal, stdout, stderr
FastForward\Fork\Worker\WorkerGroup Immutable worker collection all(), get(pid), getRunning(), getStopped(), wait(), kill()
FastForward\Fork\Signal\Signal Typed POSIX signal enum Signal::Terminate, Signal::Kill, Signal::Interrupt, exitStatus()
FastForward\Fork\Signal\DefaultSignalHandler Ready-made signal propagation strategy Graceful propagation, optional wait, escalation support

Main methods

Target Method Description
ForkManager fork(callable $callback, int $workerCount = 1) Spawn N workers for the same callback and return them as a group
ForkManager wait(WorkerInterface\|WorkerGroupInterface ...$workers) Wait for targeted workers or every worker managed by the manager
ForkManager kill(Signal $signal = Signal::Terminate, WorkerInterface\|WorkerGroupInterface ...$workers) Send a signal to targeted workers or all managed workers
Worker wait() Wait for a single worker
Worker kill() Signal a single worker
Worker getOutput() / getErrorOutput() Read captured output, including partial output while still running
WorkerGroup wait() Wait for every worker in the group
WorkerGroup kill() Signal every worker in the group
WorkerGroup getRunning() / getStopped() Inspect current group state

Exceptions

Exception Use case
FastForward\Fork\Exception\InvalidArgumentException Invalid worker count, foreign worker, foreign worker group
FastForward\Fork\Exception\LogicException Invalid control-flow usage, such as forking from a worker using the same manager
FastForward\Fork\Exception\RuntimeException Unsupported runtime, fork failure, wait failure, transport allocation failure
FastForward\Fork\Exception\ForkExceptionInterface Catch-all contract for library-specific exceptions

๐Ÿ”Œ Integration

This library is intentionally small and integrates cleanly with CLI-oriented PHP applications:

This package is best suited for:

๐Ÿ“ Directory Structure

โš™๏ธ Advanced and Customization

Custom signal handling

You can replace the default shutdown strategy entirely by implementing FastForward\Fork\Signal\SignalHandlerInterface and injecting it into the manager:

Output capture model

The library transfers worker output through socket pairs so the master process can inspect partial or final output while workers run.

What is captured:

What is not intercepted automatically:

If you need descriptor-level capture, you will need explicit descriptor redirection in your own worker code.

Nested process trees

The same ForkManager instance cannot be reused from inside a worker process. If a worker needs to create its own child workers, instantiate a new manager inside that worker process.

๐Ÿ› ๏ธ Versioning and Upgrade Notes

โ“ FAQ

Does this package emulate workers when pcntl or posix are missing?
No. The manager fails explicitly with RuntimeException when the runtime is not supported.

Can I read worker output before wait() finishes?
Yes. Worker::getOutput() and Worker::getErrorOutput() can expose partial output while the worker is still running.

Can I wait for everything without tracking each group manually?
Yes. Calling $manager->wait() with no arguments waits for every worker created by that manager.

Can I kill only some workers?
Yes. You can target individual Worker instances, entire WorkerGroup instances, or mix both in a single manager call.

Can a worker reuse the parent manager to create nested workers?
No. A worker must create a new manager if it needs its own process tree.

Does this library work in web requests?
It is designed for CLI-like runtimes with POSIX process control available. Inference from the required functions: it is generally a poor fit for standard web SAPIs and unsupported on environments without pcntl/posix.

๐Ÿ“Š Comparison

Capability fast-forward/fork Manual pcntl_* orchestration
Typed signals via enum โœ… โŒ
Immutable worker groups โœ… โŒ
Worker objects with state inspection โœ… โŒ
Partial output capture โœ… โŒ
PSR-3 logger integration โœ… โŒ
Default signal propagation strategy โœ… โŒ
Named library exceptions โœ… โŒ
Ordered learning examples โœ… โŒ

๐Ÿงช Examples

The repository includes a numbered progression of examples:

๐Ÿ›ก License

MIT ยฉ 2026 Felipe Sayรฃo Lobato Abreu

See LICENSE for details.

๐Ÿค Contributing

Issues, ideas, and pull requests are welcome.

Recommended local checks:

If you use the Fast Forward dev tooling in this repository, you can also run:

๐Ÿ”— Links

Keywords for discoverability: PHP worker pool, pcntl_fork wrapper, POSIX signal handling, process manager, parallel CLI jobs, worker orchestration, PSR-3 logging, Fast Forward PHP.


All versions of fork with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
psr/log Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fast-forward/fork contains the following files

Loading the files please wait ...