PHP implementation of the Twilic wire format and session-aware encoder/decoder.
This library's default encode / decode API targets Twilic v2.
- Dynamic encoding/decoding (
encode,decode) - Schema-aware encoding (
encode_with_schema) - Batch encoding (
encode_batch,SessionEncoder) - Codec primitives (
Twilic\Codec) and v2 wire profile (Twilic\V2)
twilic-php/
src/bootstrap.php # global encode/decode helpers
src/Twilic/ # wire, model, codec, session, v2
tests/
scripts/ # Rust interop fixtures and smoke checks
bin/ # interop CLI helpers
docs/
- PHP 8.3 or later
- Composer
From source (until published on Packagist):
composer require twilic/twilic:@dev<?php
require 'vendor/autoload.php';
use function Twilic\decode;
use function Twilic\encode;
use function Twilic\new_map;
use function Twilic\new_string;
use function Twilic\new_u64;
use function Twilic\entry;
$value = new_map(
entry('id', new_u64(1001)),
entry('name', new_string('alice')),
);
$data = encode($value);
$decoded = decode($data);Run checks locally:
composer install
composer testRust client interop smoke check (PHP server → Rust client):
bash scripts/check-rust-client-interop.shPHP client interop smoke check (Rust server → PHP client):
bash scripts/check-php-client-interop.shFull bidirectional interop (unit tests + both directions; requires ../twilic-rust or TWILIC_RUST_ROOT):
bash scripts/check-interop.shDocumentation is formatted and linted with Prettier and markdownlint (see docs/CONTRIBUTING.md).
- CI workflow:
.github/workflows/ci.yml - Commitlint, invisible character check, and PR body validation workflows under
.github/workflows/ - Interop workflow:
.github/workflows/interop.yml
This library mirrors the Twilic wire format spec at twilic/twilic and tracks twilic-python and twilic-java.
This project is licensed under the MIT License - see the LICENSE file for details.