v0.1.0
First release of the PHP client for LadybugDB — an embedded graph database (formerly Kuzu).
Two backends, one API. The library talks to liblbug either through a native PHP extension or through FFI, and picks whichever is available at runtime.
$database = new Ladybug\Database('/var/data/graph.lbdb');
$connection = $database->connect();
$connection->run('CREATE (:Person {name: $name, age: $age})', ['name' => 'Ada', 'age' => 36]);
foreach ($connection->query('MATCH (p:Person) WHERE p.age > $min RETURN p.name', ['min' => 30]) as $row) {
echo $row['p.name'], PHP_EOL;
}What is in it
- Native extension (
ext/) — value conversion in C, linked against liblbug dynamically (~90 KB.so) or statically (--enable-ladybug-static, ~20 MB, no liblbug dependency) - FFI connector — no compilation, just the shared library
- Connector factory — explicit choice via
Config,LADYBUG_CONNECTORoverride, or highest-priority available backend, with diagnostics that name every path searched - Streaming results, prepared statement cache, transactions, multi-statement results
- Full type mapping:
NODE,REL, temporal types ontoDateTimeImmutable/DateInterval,DECIMALandINT128as numeric strings so nothing is lost
Verified
CI runs on PHP 8.2, 8.3, 8.4 and 8.5 across Linux x86_64 and macOS arm64, executing the integration suite once per connector on each runtime — that is what holds the C and PHP conversion code to identical behaviour. 173 PHP tests (107 integration) plus 4 .phpt, PHPStan level 8, Rector and PHP-CS-Fixer clean. Against liblbug 0.19.1.
Known gaps
RECURSIVE_RELarrives as liblbug's own rendering rather than a typed path object- No Arrow / bulk-copy ingestion
- No PIE / PECL package for the extension yet
- Windows is untested
Requires PHP 8.2+. MIT licensed.