Skip to content

Commit c1d6a68

Browse files
committed
feat: Add Composer badge to README.md
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent b022ef7 commit c1d6a68

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

README.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ A PHP 8.3+ library for orchestrating forked workers with typed signals, immutabl
44
captured worker output, and PSR-3 logging.
55

66
[![PHP Version](https://img.shields.io/badge/php-^8.3-777BB4?logo=php&logoColor=white)](https://www.php.net/releases/)
7+
[![Composer Package](https://img.shields.io/badge/composer-fast--forward%2Ffork-F28D1A.svg?logo=composer&logoColor=white)](https://packagist.org/packages/fast-forward/fork)
78
[![Tests](https://img.shields.io/github/actions/workflow/status/php-fast-forward/fork/tests.yml?logo=githubactions&logoColor=white&label=tests&color=22C55E)](https://github.com/php-fast-forward/fork/actions/workflows/tests.yml)
89
[![Coverage](https://img.shields.io/badge/coverage-phpunit-4ADE80?logo=php&logoColor=white)](https://php-fast-forward.github.io/fork/coverage/index.html)
910
[![Docs](https://img.shields.io/github/deployments/php-fast-forward/fork/github-pages?logo=readthedocs&logoColor=white&label=docs&labelColor=1E293B&color=38BDF8&style=flat)](https://php-fast-forward.github.io/fork/index.html)
@@ -187,36 +188,36 @@ posix_kill($manager->getMasterPid(), Signal::Terminate->value);
187188

188189
### Core classes
189190

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

198199
### Main methods
199200

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

212213
### Exceptions
213214

214-
| Exception | Use case |
215-
|-----------|----------|
216-
| `FastForward\Fork\Exception\InvalidArgumentException` | Invalid worker count, foreign worker, foreign worker group |
217-
| `FastForward\Fork\Exception\LogicException` | Invalid control-flow usage, such as forking from a worker using the same manager |
218-
| `FastForward\Fork\Exception\RuntimeException` | Unsupported runtime, fork failure, wait failure, transport allocation failure |
219-
| `FastForward\Fork\Exception\ForkExceptionInterface` | Catch-all contract for library-specific exceptions |
215+
| Exception | Use case |
216+
|-------------------------------------------------------|----------------------------------------------------------------------------------|
217+
| `FastForward\Fork\Exception\InvalidArgumentException` | Invalid worker count, foreign worker, foreign worker group |
218+
| `FastForward\Fork\Exception\LogicException` | Invalid control-flow usage, such as forking from a worker using the same manager |
219+
| `FastForward\Fork\Exception\RuntimeException` | Unsupported runtime, fork failure, wait failure, transport allocation failure |
220+
| `FastForward\Fork\Exception\ForkExceptionInterface` | Catch-all contract for library-specific exceptions |
220221

221222
## 🔌 Integration
222223

@@ -360,16 +361,16 @@ it is generally a poor fit for standard web SAPIs and unsupported on environment
360361

361362
## 📊 Comparison
362363

363-
| Capability | `fast-forward/fork` | Manual `pcntl_*` orchestration |
364-
|------------|---------------------|--------------------------------|
365-
| Typed signals via enum |||
366-
| Immutable worker groups |||
367-
| Worker objects with state inspection |||
368-
| Partial output capture |||
369-
| PSR-3 logger integration |||
370-
| Default signal propagation strategy |||
371-
| Named library exceptions |||
372-
| Ordered learning examples |||
364+
| Capability | `fast-forward/fork` | Manual `pcntl_*` orchestration |
365+
|--------------------------------------|---------------------|--------------------------------|
366+
| Typed signals via enum | | |
367+
| Immutable worker groups | | |
368+
| Worker objects with state inspection | | |
369+
| Partial output capture | | |
370+
| PSR-3 logger integration | | |
371+
| Default signal propagation strategy | | |
372+
| Named library exceptions | | |
373+
| Ordered learning examples | | |
373374

374375
## 🧪 Examples
375376

0 commit comments

Comments
 (0)