# spatie/fork

A lightweight solution for running code concurrently in PHP

Repository: https://github.com/spatie/fork
Canonical: https://ross.abutalabs.com/products/fork
Homepage: https://spatie.be/open-source
Language: PHP
License: MIT
License Family: permissive
Topics: php, concurrent, performance, async
Last push: 2026-06-02T06:58:14+00:00

## Health v2 (maintenance only)
Score: 81/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 85, release rhythm 65, longevity 100
- inputs: {"age_days": 1959, "days_push": 92, "days_rel": 159, "gap_med": 66.0, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1046, forks 114 (observed 2026-08-28T04:03:21.752034+00:00)

## What it is
A lightweight PHP library for running code concurrently by forking the main PHP process into child tasks. It lets you pass multiple closures to a single run call and collect their return values, requiring PHP 8 with the pcntl extension in CLI contexts.

## Use cases
- run multiple slow API calls in parallel from PHP
- execute closures concurrently in a PHP CLI script
- speed up batch processing by forking PHP processes
- parallelize independent tasks in PHP without async complexity
- fan out work to child processes and collect results

## When to choose
- you need simple process-based concurrency in PHP CLI scripts
- you want a minimal API without learning async frameworks
- your tasks are independent and communicate only via return values

## When to avoid
- you need concurrency in a web (non-CLI) request context, since pcntl is unavailable there
- you need shared memory or message passing between tasks
- you target Windows or environments without the pcntl extension

## Facets
- artifact type: library
- maturity: active
- function: concurrency, developer-tools
- domain: developer-tools, performance
- platform: cli, php
- tags: process-forking, pcntl, parallel-execution, php, linux, macos

## Member repositories
- spatie/fork (main) score 81

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:21.752034+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:01:59.787456+00:00, confidence not recorded.
  - readme: https://github.com/spatie/fork (fetched 2026-08-28T04:03:21.752034+00:00, sha 1d12552baf42)
  - homepage: https://spatie.be/open-source (fetched 2026-08-29T13:02:42.492856+00:00, sha 6ed5abf69535)
  - site_page: https://spatie.be/docs (fetched 2026-08-29T13:02:42.502610+00:00, sha 08e024d86d95)
  - site_page: https://spatie.be/about-us (fetched 2026-08-29T13:02:42.504900+00:00, sha d3cb88e4b34c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
