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.
Note
Choose a version


v1 (stable)
The current stable release. Direct RPC-style methods over HTTP and WebSocket.


v2 (alpha)
The rewrite with fluent query builders and typed credentials. Alpha, breaking changes.
Migration guide
Move an existing project from v1 to v2, with a method-by-method mapping.
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.

