Version 2 of the PHP SDK is installed with Composer. It requires PHP 8.4 or later.
Install the SDK
Version 2 is an alpha release, so you need to request the exact version. Composer will not select it under the default stable minimum stability.
If you want Composer to keep tracking alpha releases, set the stability flag instead:
Add an HTTP client
The HTTP engine uses PSR-18 and PSR-17 interfaces rather than a built-in client. Install a compatible client and factory implementation, plus discovery so the SDK can find them automatically.
Note
Import the SDK
Include the Composer autoloader, then import the classes you need from the SurrealDB\SDK namespace.
Next steps
Quickstart to connect and run your first queries
Connecting to SurrealDB for connection options and reconnection
Migration guide if you are coming from v1