mohamedhabibwork / laravel-oci-driver
This is my package laravel-oci-driver
Fund package maintenance!
Mohamed Habib
Requires
- php: ^8.2 | ^8.3| ^8.4
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-05-11 19:05:10 UTC
README
A Laravel filesystem driver for Oracle Cloud Infrastructure (OCI) Object Storage. This package integrates seamlessly with Laravel's storage system, allowing you to use OCI Object Storage just like any other Laravel storage driver.
Features
- Full integration with Laravel's filesystem abstraction
- Support for all standard file operations (read, write, delete, etc.)
- Support for temporary URLs
- Configurable storage tier
- Proper authentication using OCI API keys
- PHP 8.2+ and Laravel 10+ support
Installation
You can install the package via composer:
composer require mohamedhabibwork/laravel-oci-driver
Configuration
After installation, publish the configuration file:
php artisan vendor:publish --tag="laravel-oci-driver-config"
Then, add the following to your config/filesystems.php
file in the disks
array:
'oci' => [ 'driver' => 'oci', 'namespace' => env('OCI_NAMESPACE'), 'region' => env('OCI_REGION'), 'bucket' => env('OCI_BUCKET'), 'tenancy_id' => env('OCI_TENANCY_ID'), 'user_id' => env('OCI_USER_ID'), 'storage_tier' => env('OCI_STORAGE_TIER', 'Standard'), 'key_fingerprint' => env('OCI_KEY_FINGERPRINT'), 'key_path' => env('OCI_KEY_PATH'), ],
Add the following environment variables to your .env
file:
OCI_NAMESPACE=your-namespace
OCI_REGION=your-region
OCI_BUCKET=your-bucket-name
OCI_TENANCY_ID=your-tenancy-id
OCI_USER_ID=your-user-id
OCI_STORAGE_TIER=Standard
OCI_KEY_FINGERPRINT=your-key-fingerprint
OCI_KEY_PATH=/path/to/your/oci/private-key.pem
Usage
Once configured, you can use the OCI driver just like any other Laravel storage driver:
// Store a file Storage::disk('oci')->put('file.txt', 'Contents'); // Get a file $contents = Storage::disk('oci')->get('file.txt'); // Check if a file exists $exists = Storage::disk('oci')->exists('file.txt'); // Delete a file Storage::disk('oci')->delete('file.txt'); // Generate a temporary URL (valid for 1 hour) $url = Storage::disk('oci')->temporaryUrl('file.txt', now()->addHour());
You can also use the Storage
facade with the default disk if you've set OCI as your default in config/filesystems.php
:
// In config/filesystems.php 'default' => env('FILESYSTEM_DISK', 'oci'), // Then in your code Storage::put('file.txt', 'Contents');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.