Skip to content
AjmalAlkhalediPublic
forked from asyncara/asyncara

About

A next-generation asynchronous and parallel runtime for PHP, featuring Fiber-based scheduling, non-blocking I/O, transparent runtime hooks, native database drivers, and multi-process execution.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

Asyncara

Native Async API First — Optional Transparent Compatibility.

Asyncara provides asynchronous PHP APIs for HTTP clients and servers, databases, files, networking and parallel process jobs. Version 0.10.0 is EXPERIMENTAL: it is an initial usable release, not a production-readiness guarantee.

Developer documentation · Installation · Runnable examples

Install a prebuilt bundle

On a supported Linux/PHP configuration, install directly from the public release. No GitHub account or GitHub CLI is required:

curl -fsSL https://github.com/asyncara/asyncara/releases/download/v0.10.0/install.sh | sh
asyncara --check
asyncara --example 127.0.0.1:8080

The installer detects the platform, PHP version and NTS/ZTS mode, selects an available bundle, verifies SHA-256 and installs a launcher without changing the original php.ini. It does not compile locally or require Python. Follow the printed PATH instruction when necessary. A missing supported tuple is an error, not an implicit source build.

The initial Linux bundles target Ubuntu 24.04 x86_64 and PHP 8.3.36, 8.4.27 or 8.5.12 NTS. Android 64-bit preview packages have separate requirements; see the compatibility matrix. Ubuntu/Kali aarch64 (including Android proot), Windows and 32-bit packages are unavailable. Native Android/Termux packages are not Linux/glibc packages. PIE is not a complete supported installation method for v0.10.0; use the package containing the extension, PHP library and launcher.

If you already have a matching package and installer, follow the offline installation steps.

Start a server

Save as server.php and run asyncara server.php:

<?php
use Asyncara\App;
use Asyncara\Async;
use Asyncara\Server\{Request, Response};

$app = new App();
$app->get('/status', fn() => Response::json(['status' => 'OK']));
$app->get('/work/{id}', function (Request $request): Response {
    Async::sleep(0.01); // Seconds; yields while other requests make progress.
    return Response::json(['id' => $request->param('id')]);
});
$app->post('/data', fn(Request $request) => Response::json($request->json(), 201));
$app->listen('127.0.0.1:8080');

Native Server uses HTTP/1.1 and Fiber handlers. Routing, middleware, bounded streaming, TLS and worker options are explained in the server guide.

Choose explicit asynchronous APIs

Capability Execution backend
HTTP client Event-driven curl multi; optional Rust Hyper
TCP / UDP / TLS Native nonblocking socket readiness
PostgreSQL Nonblocking libpq
MySQL / MariaDB Connector/C asynchronous state machine
Redis Nonblocking TCP and RESP
Files / SQLite / DNS Bounded native workers
ProcessPool Separate PHP processes

A native API is not necessarily kernel-level async I/O. Files use pthread workers; io_uring filesystem operations are not implemented. Optional timer hooks do not make PDO, cURL or ordinary PHP filesystem calls asynchronous. ProcessPool requires the complete runtime worker entry point, which the first Linux binary bundle omits; see the package limitation.

Build and validate from source

Use matching PHP headers, phpize and php-config, plus C11, libcurl and SQLite development dependencies. Optional libpq, Connector/C and Hyper need their corresponding libraries. The Hyper-enabled server requires the matching Rust bridge built from the committed Cargo.lock.

cd ext
phpize
./configure --enable-asyncara --with-php-config="$(command -v php-config)"
make -j2
php -n -d extension="$PWD/modules/asyncara.so" --ri asyncara

This minimal build does not enable optional database drivers or Hyper. Use --with-asyncara-pq, --with-asyncara-mysql and --with-asyncara-hyper=/absolute/path/to/bridge/release only with their required dependencies. Install Composer dependencies from the repository root and load the extension explicitly. No global PHP configuration change is required.

Tests, deterministic local fixtures, allocation audits and CI remain in this repository. Developer guides live exclusively in asyncara/docs.

Development branches

x.0 is the default release line; x.0-dev contains ongoing development. For application setup and examples, use the developer documentation.

License

Copyright © 2026 Ajmal Alkhaledi. Asyncara is licensed under PolyForm Strict License 1.0.0. See the complete license for permissions and restrictions. Composer's proprietary value is metadata only. Third-party libraries retain their own licenses and notices.

About

A next-generation asynchronous and parallel runtime for PHP, featuring Fiber-based scheduling, non-blocking I/O, transparent runtime hooks, native database drivers, and multi-process execution.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages