The integration registers two service providers, binds the SDK and ORM into the container, and exposes three facades.
Service providers
Laravel auto-discovers both providers.
SurrealDB\Laravel\SurrealDBServiceProviderowns the SDK configuration, client construction, and thesurrealdbcontainer alias.SurrealDB\Laravel\SurqlizeServiceProviderowns the ORM configuration, the schema commands, Surqlize's executor binding, andConnectionManagersetup.
Container bindings
The SDK provider binds:
SurrealDB\SDK\Surrealand thesurrealdbalias for the raw SDK client.SurrealDB\Laravel\SurrealDBManagerplus thesurrealdb.managerandsurrealdb.connectionaliases for the Laravel lifecycle helpers.
The ORM provider binds:
SurrealDB\SDK\Contracts\QueryExecutorfor Surqlize query execution.Surqlize\Model\SchemaManagerfor schema definitions and application.SurrealDB\Laravel\SurqlizeManagerand thesurqlizealias for the Laravel-friendly ORM helpers.
The ORM provider also registers Surqlize's global ConnectionManager with a lazy executor that resolves the configured surqlize.executor binding only when a query runs. By default that points at surrealdb.connection, so model queries use the Laravel-managed connection and connect lazily.
Facades
The integration ships three facades in the SurrealDB\Laravel\Facades namespace.
SurrealDB
The manager facade. It manages named connections, runs SurrealQL, and exposes lifecycle and testing helpers. Most methods take an optional connection name.
| Method | Description |
|---|---|
run($surql, $bindings, $connection?) | Run raw SurrealQL |
query($query, $connection?) | Run a BoundQuery |
client($name?) / connection($name?) | Resolve the SDK client or its controller |
connect() / disconnect() / reconnect() / isConnected() | Manage the connection lifecycle |
health() / version() | Check the server |
using($connection) | Get an executor scoped to a connection |
fake() / assertSurrealQuerySent() / resetFakes() | Testing helpers |
Surreal
Resolves the underlying SDK Surreal client for direct, lower-level access.
Surqlize
Exposes the ORM manager: the executor, schema helpers, and transactions.
| Method | Description |
|---|---|
executor() | The configured Surqlize executor |
schemaDefinitions($models?) | The schema statements for the models |
applySchema($models?, $executor?) | Apply the schema |
transaction($callback, $executor?, $connection?) | Run a transaction |
Learn more
Configuration for the settings these bindings read
Queries and transactions for using the facades
Testing for the fake executor