Download the PHP package prahsys/laravel-supabase without Composer
On this page you can find all versions of the php package prahsys/laravel-supabase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prahsys/laravel-supabase
More information about prahsys/laravel-supabase
Files in prahsys/laravel-supabase
Package laravel-supabase
Short Description A Laravel 12+ package for seamless integration with Supabase, including UUID handling and database features
License MIT
Informations about the package laravel-supabase
Prahsys Laravel Supabase Integration
A Laravel package for seamless integration with Supabase, providing PostgreSQL-specific features for Laravel applications.
Development
This package can be developed locally within a Laravel application. The main project includes tooling to easily switch between local development and remote package installations.
Working with Local Package Development
To switch between developing locally and using the published package:
-
Use local development version:
- Use remote published version:
The local development mode creates a symlink to the package in the packages/ directory, allowing you to make changes directly to the package code while testing in your application.
Features
Supabase Database Driver
The package registers a dedicated supabase database driver that you can use in your Laravel database configuration. This driver extends the default PostgreSQL driver with automatic handling of UUID columns in:
- Where clauses
- Join conditions
- WhereIn statements
The driver works in two ways:
- It automatically detects common UUID column patterns (like 'id', '*_id', etc.)
- It works with the
CastsUuidColumnstrait to allow explicit UUID column definition
UUID Handling in Supabase
When working with UUIDs in Supabase, comparing a UUID column with a string value requires explicit casting. This is especially important because Supabase doesn't allow creating global implicit casts or custom operators that would normally solve this issue in a standard PostgreSQL installation.
With the Supabase driver, these casts are applied automatically, so you can write normal Laravel queries:
Explicit UUID Column Definition
For more precise control, you can use the CastsUuidColumns trait to explicitly define UUID columns in your models:
The trait:
- Automatically includes the primary key as a UUID column
- Adds any columns specified in the
$uuidColumnsproperty - Communicates this information to the query builder for proper UUID handling
Custom UUID Column Detection
For advanced use cases, you can also register a custom UUID column detector function:
This allows for full customization of UUID column detection beyond the built-in naming conventions.
Installation
Database Configuration
You can use the custom supabase driver in your config/database.php:
The supabase driver is a PostgreSQL driver with additional configurations optimized for Supabase, so you can use it just like the standard pgsql driver.
Development and Testing
Running Tests
To run the tests:
This will run all tests using SQLite in-memory database for speed.
Testing with a Real Supabase Connection
To test with a real Supabase database:
- Edit the
.env.testingfile with your Supabase credentials - Run the special test command:
This is useful for verifying PostgreSQL functionality in an actual database environment.
Compatibility
- Laravel 10.x, 11.x, and 12.x
- PHP 8.1 and above
- PostgreSQL databases including Supabase
License
This package is open-sourced software licensed under the MIT license.