The Laravel integration connects SurrealDB to a Laravel application. It wires version 2 of the SDK and the Surqlize ORM into Laravel's config, service container, facades, and Artisan commands.
Query execution and the database protocol are delegated to the SDK. Models, query compilation, graph relations, and schema definitions are delegated to Surqlize. The integration adds the Laravel glue: publishable config, container bindings, facades, schema commands, and testing helpers.
Important
It does not replace Laravel's SQL database. SurrealDB runs alongside your existing connections, and the integration does not use Eloquent or config/database.php.
Getting started
Installation
Install the package and publish its configuration.
Configuration
Set connection details, auth modes, and multiple connections.
Using the integration
Container and facades
The service providers, container bindings, and the SurrealDB, Surreal, and Surqlize facades.
Queries and transactions
Run model queries, raw SurrealQL, and transactions in Laravel.
Schema commands
Dump and apply your Surqlize schema with Artisan.
Testing
Fake the executor and assert the queries your code sends.
Sources
Surqlize ORM for models and queries
PHP SDK v2 for the underlying client