boone-studios / laravel-surrealdb
Integrates SurrealDB with the Laravel framework
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.2
- illuminate/container: ^9.0
- illuminate/database: ^9.0
- illuminate/events: ^9.0
- illuminate/support: ^9.0
Requires (Dev)
- doctrine/dbal: ^2.13.3 || ^3.1.4
- ergebnis/composer-normalize: ^2.28
- mockery/mockery: ^1.3.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.22
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-10-17 14:20:39 UTC
README
Overview
This package allows you to add a connection to SurrealDB in your Laravel project.
Installation
You can install the package via Composer:
composer require boone-studios/laravel-surrealdb
Usage
Laravel
If you are using an older version of Laravel that doesn't support autoloading packages, add the service provider to config/app.php
:
BooneStudios\Surreal\SurrealServiceProvider::class
Lumen
Add the service provider to bootstrap/app.php
in your project.
$app->register(BooneStudios\Surreal\SurrealServiceProvider::class);
Configuration
To configure a new SurrealDB connection, add a new connection entry to config/database.php
:
'surrealdb' => [ 'driver' => 'surrealdb', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', 8000), 'namespace' => env('DB_NAMESPACE', 'laravel'), 'database' => env('DB_DATABASE', 'app'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', 'root'), ],
Regarding the namespace
parameter, from the SurrealDB documentation:
SurrealDB has a multi-tenancy model which allows you to scope databases to a namespace. There is no limit to the number of databases that can be in a namespace, nor is there a limit to the number of namespaces allowed. Only users root users are authorized to create namespaces.
Let's say that you're using SurrealDB to create a multi-tenant SaaS application. You can guarantee that the data of each tenant will be kept separate from other tenants if you put each tenant's databases into separate namespaces. In other words, this will ensure that information will remain siloed so user will only have access the information in the namespace they are a member of.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email support@boonestudios.org instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.