boone-studios/laravel-surrealdb
A Laravel integration for SurrealDB that brings query building, Eloquent-style models, migrations, authentication, and configuration helpers, making it easy to use SurrealDB as your application's database.
Install the package (pre-release only at v0.3.0):
composer require boone-studios/laravel-surrealdb:^0.3.0
Pin the exact pre-release version in composer.json — this is explicitly a testing pre-release with no stability guarantees.
Publish the config (if the package provides one):
php artisan vendor:publish --provider="BooneStudios\SurrealDB\SurrealDBServiceProvider"
Review config/surrealdb.php first. The important values are the SurrealDB endpoint (HTTP or WebSocket URL), namespace, database, and credentials.
Add the connection to config/database.php and environment variables:
'surrealdb' => [
'driver' => 'surrealdb',
'url' => env('SURREALDB_URL', 'http://127.0.0.1:8000'),
'namespace' => env('SURREALDB_NAMESPACE', 'laravel'),
'database' => env('SURREALDB_DATABASE', 'app'),
'username' => env('SURREALDB_USERNAME', 'root'),
'password' => env('SURREALDB_PASSWORD', 'root'),
],
First use case — smoke test the connection:
use Illuminate\Support\Facades\DB;
$result = DB::connection('surrealdb')->select('SELECT * FROM user LIMIT 10;');
If DB::connection('surrealdb') fails, check that the service provider is auto-discovered and that the driver name matches the package’s expected key.
Where to look next: the package README, the service provider, and any facade or model base class shipped in src/. Since v0.3.0 is a pre-release, the README is the most reliable source for the current API surface.
DB::connection('surrealdb'), DB::transaction(), and connection switching work consistently across the app.DB::select. If the package exposes a builder or model abstraction, use it — particularly for parameter binding, since SurrealQL parameter syntax differs from SQL.surrealdb connections for local, testing, and production, each pointing at different namespaces/databases. This aligns well with SurrealDB’s namespace/database isolation.setUp() (or use RefreshDatabase if the package supports it). Avoid hitting a shared dev instance — SurrealDB namespaces make it cheap to create an isolated test one.? placeholders work.surrealdb) while the package expects another. Confirm the driver name in the package’s service provider.SurrealDB facade binding in the service provider. Binding your own client or repository implementation there is the cleanest way to customize behavior without forking.hasMany, where, or relationship methods behave like SQL Eloquent. Use the package’s documented query interface instead.How can I help you explore Laravel packages today?