• Start

Languages

/

PHP

Overview

The SurrealDB SDK for PHP lets you query a remote SurrealDB instance from any PHP application, with a stable v1 release and a v2 rewrite in alpha.

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.

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.

Was this page helpful?