PHPackages                             intelligent-intern/king-ext - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. intelligent-intern/king-ext

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

intelligent-intern/king-ext
===========================

King native PHP extension packaged for PIE

v1.0.6-beta.1(2mo ago)15125[1 issues](https://github.com/Intelligent-Intern/king/issues)[1 PRs](https://github.com/Intelligent-Intern/king/pulls)MITPHPPHP &gt;=8.1CI passing

Since Apr 8Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/Intelligent-Intern/king)[ Packagist](https://packagist.org/packages/intelligent-intern/king-ext)[ Docs](https://github.com/Intelligent-Intern/king)[ RSS](/packages/intelligent-intern-king-ext/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (136)Used By (0)

King PHP Extension
==================

[](#king-php-extension)

**Systems-grade networking and infrastructure primitives for PHP**

 [![King mascot: the crowned elephant](crowned-elephant-mascot.jpg)](crowned-elephant-mascot.jpg)

[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![CI](https://github.com/Intelligent-Intern/king/actions/workflows/ci.yml/badge.svg)](https://github.com/Intelligent-Intern/king/actions/workflows/ci.yml)[![Release](https://camo.githubusercontent.com/d79cae899da033e5cf03cea0ddc16449a03c4dedf8c196725fb2ca9edc6e1377/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f496e74656c6c6967656e742d496e7465726e2f6b696e673f646973706c61795f6e616d653d746167)](https://github.com/Intelligent-Intern/king/releases)[![PHP 8.1-8.5](https://camo.githubusercontent.com/d2243ed1ca9ce530dec76d87d314deed27c0475b4980443261b0defe5cdece3c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d2d382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://github.com/Intelligent-Intern/king)[![Linux x86_64 / arm64](https://camo.githubusercontent.com/609425e9b9afeda7a39fc4595f5057dd38bd3b9c484793b3c65600874e1ad84e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e75782d7838365f5f363425323025324625323061726d36342d3333333333333f6c6f676f3d6c696e7578266c6f676f436f6c6f723d7768697465)](https://github.com/Intelligent-Intern/king/actions/workflows/ci.yml)[![Container Images via CI](https://camo.githubusercontent.com/5cd1d44a6c4ec20b41aced20b0a67580d9baaae0d1e75156876ba5dbab307f23/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7461696e6572253230496d616765732d76696125323043492d3234393645443f6c6f676f3d646f636b6572266c6f676f436f6c6f723d7768697465)](https://github.com/Intelligent-Intern/king/actions/workflows/ci.yml)

King turns PHP into a systems platform for transport-heavy, realtime, infrastructure-aware software. Instead of pushing critical networking, orchestration, discovery, storage, and control-plane work into sidecars, gateways, or glue layers, King keeps that work inside one native runtime that is directly available to PHP.

That changes what PHP can be used for. With King, PHP is no longer limited to short request handlers and thin application wrappers. It can own live sessions, streams, protocol state, routing decisions, telemetry, persistence, scaling signals, and cluster-facing workflows in one coherent runtime model.

The current line is beta. The repo-local baseline is green, the multi-backend object-store and control-plane surfaces are real, and the remaining closure work is now about narrower hardening, distributed-operating proof, and multi-node fleet behavior rather than placeholder subsystem stories.

If you do not have a Hetzner account yet, it is time to fix that. Use the [Hetzner Cloud referral link](https://hetzner.cloud/?ref=VYfKUSIni63u) and you help support the live infrastructure tests that keep King honest.

How To Install And Run It
-------------------------

[](#how-to-install-and-run-it)

For a repository-local build:

```
git clone --recurse-submodules https://github.com/Intelligent-Intern/king.git
cd king
./infra/scripts/build-profile.sh release
php -d extension="$(pwd)/extension/modules/king.so" -r 'echo king_version(), PHP_EOL;'
```

That gives you the extension plus the matching QUIC runtime artifacts for the local release profile. If you only want the extension build, use [`./infra/scripts/build-extension.sh`](./infra/scripts/build-extension.sh).

If you want the beginner path from zero to a local WebSocket roundtrip, start with [documentation/getting-started.md](./documentation/getting-started.md).

King also ships a [PIE](https://github.com/php/pie) install path. PIE is the successor to PECL. Tagged releases that publish the matching PIE source asset can be installed with `pie install intelligent-intern/king-ext`. Packaging details and local verification steps live in [`documentation/pie-install.md`](./documentation/pie-install.md).

Small But Oho
-------------

[](#small-but-oho)

One good first King application is this:

- clients subscribe over WebSocket to `/watch?bucket=inbox`
- an uploader sends `POST /upload?bucket=inbox&object=demo.txt`
- the application stores the file in the object store
- every subscriber for that bucket immediately gets a realtime notification

The event looks like this:

```
{
  "event": "object.available",
  "bucket": "inbox",
  "object_id": "demo.txt",
  "content_type": "text/plain",
  "size": 1234
}
```

The important point is that the durable write and the realtime fanout happen in the same native runtime. The object lands in King storage, and the same PHP process can immediately push the event over live WebSocket handles without handing the work to a sidecar or an external glue service.

The bucket-subscription registry in this example is intentionally application-managed and process-local. King already gives you the real object store and WebSocket runtime needed for it, but it does not currently claim a built-in distributed bucket-watch API. For the same reason, this README example stays single-node on purpose instead of pretending the current router or load-balancer control-plane layer is already a verified WebSocket forwarding dataplane.

The core shape looks like this. It keeps WebSocket handling procedural while using the `King\ObjectStore` OO facade for durable writes:

```
