https://github.com/quix-labs/laravel-supabase-flysystem
Laravel Supabase Storage Adapter
https://github.com/quix-labs/laravel-supabase-flysystem
flysystem laravel supabase
Last synced: 26 days ago
JSON representation
Laravel Supabase Storage Adapter
- Host: GitHub
- URL: https://github.com/quix-labs/laravel-supabase-flysystem
- Owner: quix-labs
- License: mit
- Created: 2024-03-24T20:18:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T02:11:17.000Z (3 months ago)
- Last Synced: 2025-02-20T09:09:05.287Z (3 months ago)
- Topics: flysystem, laravel, supabase
- Language: PHP
- Homepage:
- Size: 59.6 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Supabase Storage Adapter
[](https://packagist.org/packages/quix-labs/laravel-supabase-flysystem)
[](https://github.com/quix-labs/laravel-supabase-flysystem/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/quix-labs/laravel-supabase-flysystem/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/quix-labs/laravel-supabase-flysystem)___
Easily integrate Supabase as a storage driver in Laravel with this Flysystem adapter.Simplify file storage and retrieval using Laravel's convenient storage system while leveraging the powerful features of Supabase.
___## Requirements
* PHP >= 8.1
* Laravel 10.x|11.x
* Fileinfo `ext-fileinfo`## Installation
To install the package, use Composer:
```bash
composer require quix-labs/laravel-supabase-flysystem
```#### Configuration
After installation, configure the Supabase driver in Laravel's `config/filesystems.php`.
Add the following to the disks array:
```php
'supabase' => [
'driver' => 'supabase',
'key' => env('SUPABASE_STORAGE_KEY'), // Use a privileged key; read-only does not work
'bucket' => env('SUPABASE_STORAGE_BUCKET'),
'endpoint' => env('SUPABASE_STORAGE_ENDPOINT'),'url' => null, // <- Automatically generated; change here if you are using a proxy
'public' => true, // Default to true
'defaultUrlGeneration' => null, // 'signed' | 'public' <- default depends on public'defaultUrlGenerationOptions' => [
'download' => false,
'transform' => [],
],'signedUrlExpires' => 60*60*24, // 1 day <- default to 1 hour (3600)
],
```## Usage
```php
// Example code for using the Supabase driver with Laravel Storage
Storage::disk('supabase')->put('file.txt', 'contents');// Custom function to generate a public URL
Storage::disk('supabase')->getAdapter()->getPublicUrl('completelyPublicFile.png', [
'download' => false, // Set this to true if you want the user's browser to automatically trigger download
// Transform only applied if the file is detected as an image; else ignored
'transform' => [
'width' => 200,
//... All options -> https://supabase.com/docs/guides/storage/serving/image-transformations#transformation-options
]]);// Custom function to generate a signed URL
Storage::disk('supabase')->getAdapter()->getSignedUrl('veryConfidentialFile.png', [
'expiresIn' => 60 * 5, // 5 minutes
//... Same options as getPublicUrl
]);
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Credits
- [COLANT Alan](https://github.com/alancolant)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.