PHPackages                             narya/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. narya/php-sdk

ActiveLibrary[Queues &amp; Workers](/categories/queues)

narya/php-sdk
=============

PHP SDK for the Narya Runtime Engine (Go) - Worker, protocol, lifecycle, UDS + MessagePack bridge

v1.0.0(3mo ago)012MITPHPPHP &gt;=8.2

Since Jan 30Pushed 3mo agoCompare

[ Source](https://github.com/EreborCodeForge/narya-php-sdk)[ Packagist](https://packagist.org/packages/narya/php-sdk)[ Docs](https://github.com/EreborCodeForge/narya-php-sdk)[ RSS](/packages/narya-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Narya PHP SDK
=============

[](#narya-php-sdk)

PHP library that integrates PHP userland with the **[Narya Runtime Engine](https://github.com/EreborCodeForge/NaryaRuntimeEngine)** (Go).
Namespace: `Narya\SDK`.

Protocol: **UDS (Unix Domain Sockets)** + **MessagePack**, handshake `NARYA1`/`OK`, 4-byte BE length framing + payload.

Components
----------

[](#components)

ComponentDescription**Worker** (`Runtime\Worker`)Orchestrates the loop: receives request from Go, calls application or handler, sends response. Resets state between requests.**WorkerBridge** (`Runtime\WorkerBridge`)UDS + MessagePack bridge: handshake, read/write frames, invokes handler.**NaryaRequest** / **WorkerRequest**Request contract and implementation (id, method, uri, path, query, headers, body, remote\_addr, host, scheme, timeout\_ms, meta, worker\_id, runtime\_version).**NaryaResponse** / **WorkerResponse**Response contract and implementation (status, headers, body, error). The Bridge adds `id` and `_meta`.**ApplicationWorker**Application (framework) contract: `handle(NaryaRequest): array**LifecycleInterface** / **LifecycleManager**Worker lifecycle: `boot()` before the loop (e.g. connect to socket), `shutdown()` on exit (max\_requests or EOF). Passed as Worker’s 4th argument or via `setLifecycle()`.Requirements
------------

[](#requirements)

- PHP 8.2+
- **msgpack** extension (`pecl install msgpack`)
- Linux or WSL (UDS not supported on native Windows)

Installation
------------

[](#installation)

```
composer require narya/php-sdk
```

Basic usage
-----------

[](#basic-usage)

The Go runtime starts each process with: `php worker.php --sock /path/to.sock`.

```
