Skip to main content

API reference

Find the classes, method signatures, parameters and return types available in Asyncara 0.10.0. Use the practical guides alongside this reference for complete examples, error handling and resource cleanup.

CapabilityReferencePractical guide
Async, Task, Future, cancellation, Context, TraceRuntimeTasks
Queues, locks, semaphores, streamsConcurrencySynchronization
App, server requests/responsesServerRouting
HttpClient and PSR adapterHTTPClient
SQL, Redis, connection poolsDatabasesTransactions
Files, sockets, WebSocket, processesI/OFiles
Error typesErrorsCancellation

Runnable examples​

The documentation repository contains complete scripts under examples. Run them with asyncara examples/tasks.php, or supply a matching extension and set ASYNCARA_AUTOLOAD when using PHP directly. Examples cover Tasks, shared-waiter cancellation, Queue backpressure, Context/streams, SQLite, bounded files, local TCP, ProcessPool and a local App/HTTP pair.

Follow the runnable examples guide for setup, commands and expected output. Replace example.net URLs in service-specific recipes with your own endpoints and configuration.

Public interfaces and integrations​

The actual server namespace is Asyncara\Server; the HTTP client namespace is Asyncara\HTTP. Their Request/Response models are different. Internal asyncara_* functions are transport implementation details. The generated list omits internal classes, destructors and copy-control magic methods; resource policies are covered in the lifecycle guides.

PSR-18 integration is in Asyncara\HTTP\Psr\Client. Supply PSR-17 response/stream factories and optionally an HttpClient. sendRequest starts a runtime when needed or cooperates with an existing one. It materializes the PSR request body and returns a buffered PSR response; arbitrary third-party stream reads may block. Do not describe this adapter as streaming or as transparent interception of other HTTP libraries.

$factory = new Nyholm\Psr7\Factory\Psr17Factory();
$client = new Asyncara\HTTP\Psr\Client($factory, $factory);
$request = $factory->createRequest('GET', 'https://api.example.net/status');
$response = $client->sendRequest($request);

Install compatible PSR dependencies and Nyholm PSR-7 through your application dependency policy. Package contents vary; Android preview bundles do not automatically supply every optional integration dependency.