◐ Shell
clean mode source ↗

PHP True Async

True Asynchronous inside PHP

Imagine PHP with coroutines, where familiar functions support concurrent I/O. No colored async functions. Just do spawn() and go!

70+ standard PHP functions work non-blocking out of the box — fread, fwrite, curl, PDO, sleep and more.

Documentation Download RFC Discord Docker


What is this?

PHP True Async brings native coroutines to the PHP core — no extensions swapping out blocking functions, no framework magic. Regular PHP functions (fread, fwrite, curl, PDO, fsockopen) become non-blocking automatically inside a coroutine.

$task1 = spawn(function() {
    $pdo = new PDO($dsn);
    $stmt = $pdo->prepare("SELECT * FROM users WHERE id = ?");
    $stmt->execute([1]);       // non-blocking I/O, yields to other coroutines
    return $stmt->fetch();
});

$task2 = spawn(function() {
    $socket = fsockopen($host, 9000);
    fwrite($socket, "ping");   // non-blocking, runs concurrently with $task1
});

Project Structure

Repository Description
php-src true-async PHP core with TrueAsync API + coroutine scheduler
php-async Extension implementing the TrueAsync API (libuv reactor)
server Async Server with Http2, Http3
php-true-async-rfc RFC, design documents and rationale
releases Pre-built binaries for Linux, macOS and Windows

Get Started

Full installation instructions for Linux, macOS, Windows and Docker: → Download & Install

Full API reference and guides: → Documentation

Contributing

We welcome contributions of all kinds — code, docs, testing, and community support. → Contributing Guide