The SurrealDB SDK for PHP lets you connect to SurrealDB from server-side applications, APIs, and command-line tools. You can run queries, manage data and authentication, call database functions, and subscribe to real-time updates with live queries. When connecting over WebSocket, the SDK reconnects automatically if the connection drops.
The SDK ships in two lines. Version 1.x is the current stable release and uses direct RPC-style methods such as $db->create($thing, $data). Version 2.x is a rewrite with a fluent query builder, typed credentials, and a PSR-based transport layer. It is in alpha and introduces breaking changes.
The latest stable release is php, documented under v1.
The 2.0.0-alpha.1 release is documented under v2. It is an alpha with breaking changes, so pin the exact version when installing it.
Choose a version
Ecosystem
Frameworks
Contributing
To contribute to the SDK code, submit an issue or pull request in the surrealdb.php repository. To contribute to this documentation, submit an issue or pull request in the docs.surrealdb.com repository.