yajra/laravel-oci8
Oracle database driver for Laravel using the PHP OCI8 extension. Adds an Illuminate/Database-compatible Oracle connection with Laravel version support (5.1+ through 13), plus optional PHPStan/Larastan helpers for OCI8-specific DB methods.
Pros:
Illuminate\Database to provide Oracle-specific query grammar, schema builder, and connection handling, ensuring seamless compatibility with Laravel’s Eloquent ORM, Query Builder, and Migrations.JOIN LATERAL, IDENTITY columns, JSON read-only support for 12c+), reducing manual SQL overhead.binary_ci for case-insensitive LIKE in 12cR2+), enabling backward/forward compatibility.Cons:
DB_PREFIX_SCHEMA).mysql/pgsql drivers. Requires:
pecl install oci8) and enabled in php.ini.config/database.php to include the oracle connection array and register the Oci8ServiceProvider (Laravel 5.5+).config/database.php setup (no auto-discovery).softDeletes with deleted_at timestamps).AUTO_INCREMENT (replaced by IDENTITY or sequences) requires explicit schema definitions. Risks include:
deleted_at soft deletes may fail if triggers aren’t properly scoped.oracle user provider mitigates this for auth but may affect general queries.updateOrCreate with nested attributes) will need workarounds.IDENTITY, sequences, or triggers)?ENUM, UUID)?JOIN LATERAL, CONNECT BY) and OCI8 quirks?pecl install oci8) and configure php.ini:
extension=oci8.so
oci8.connection_class="oci8_connection"
oci8.default_prefetch=100
oci8.privileged_connect=0
composer require yajra/laravel-oci8:^13
php artisan vendor:publish --tag=oracle
config/database.php with the oracle connection array (see README).// config/app.php
'providers' => [
Yajra\Oci8\Oci8ServiceProvider::class,
],
DatabaseMigrations or RefreshDatabase.IDENTITY columns, sequences).softDeletes, JSON attributes).| Feature | Compatibility Notes |
|---|---|
| Eloquent | Full support; use DB::connection('oracle') for queries. |
| Migrations | Supported, but require Oracle-specific syntax (e.g., IDENTITY for PKs). |
| Query Builder | Mostly compatible; some methods (e.g., whereRaw) may need Oracle syntax. |
| Caching | Works with Redis/Memcached; Oracle-specific cache drivers not included. |
| Queues | No direct impact; uses database connections for table-based queues. |
| Scouting | Supported if using database-backed search (e.g., Algolia not affected). |
| Full-Text Search | Added in v12.0.0; requires Oracle 12c+. |
| JSON | Read-only in 12c+; updates require full document replacement. |
| Authentication | Oracle user provider mitigates case-sensitivity issues. |
laravel-excel) may need Oracle syntax adjustments.spatie/laravel-permission) should work if they don’t assume MySQL/PostgreSQL features.config/database.php.DB::select('SELECT 1 FROM DUAL')).How can I help you explore Laravel packages today?