PHPackages                             yajra/laravel-oci8 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. yajra/laravel-oci8

ActiveLibrary[Database &amp; ORM](/categories/database)

yajra/laravel-oci8
==================

Oracle DB driver for Laravel via OCI8

v13.0.0(2mo ago)8703.0M↓12.5%249[15 issues](https://github.com/yajra/laravel-oci8/issues)[2 PRs](https://github.com/yajra/laravel-oci8/pulls)16MITPHPPHP ^8.3CI failing

Since Jan 15Pushed 2mo ago29 watchersCompare

[ Source](https://github.com/yajra/laravel-oci8)[ Packagist](https://packagist.org/packages/yajra/laravel-oci8)[ Fund](https://www.paypal.me/yajra)[ GitHub Sponsors](https://github.com/yajra)[ RSS](/packages/yajra-laravel-oci8/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (22)Versions (363)Used By (16)

Oracle DB driver for Laravel via OCI8
=====================================

[](#oracle-db-driver-for-laravel-via-oci8)

[![Continuous Integration](https://github.com/yajra/laravel-oci8/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/yajra/laravel-oci8/actions/workflows/continuous-integration.yml)[![Static Analysis](https://github.com/yajra/laravel-oci8/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/yajra/laravel-oci8/actions/workflows/static-analysis.yml)[![Total Downloads](https://camo.githubusercontent.com/15c34a8d821e05fc9e12c5a707412bf6b00c696020bf540929f0e1d4f7e3a42d/68747470733a2f2f706f7365722e707567782e6f72672f79616a72612f6c61726176656c2d6f6369382f642f746f74616c2e737667)](https://packagist.org/packages/yajra/laravel-oci8)[![Latest Stable Version](https://camo.githubusercontent.com/52aa0351cf9a08e178356ae1734f0dfe179b854530fc6490930a13375e800935/68747470733a2f2f706f7365722e707567782e6f72672f79616a72612f6c61726176656c2d6f6369382f762f737461626c652e737667)](https://packagist.org/packages/yajra/laravel-oci8)[![License](https://camo.githubusercontent.com/b0638f84f86a85b8703803f5e66fca5a99f32dd3b02dd3950115b5014a52f111/68747470733a2f2f706f7365722e707567782e6f72672f79616a72612f6c61726176656c2d6f6369382f6c6963656e73652e737667)](https://packagist.org/packages/yajra/laravel-oci8)

Laravel-OCI8
------------

[](#laravel-oci8)

Laravel-OCI8 is an Oracle Database Driver package for [Laravel](http://laravel.com/). Laravel-OCI8 is an extension of [Illuminate/Database](https://github.com/illuminate/database) that uses [OCI8](http://php.net/oci8) extension to communicate with Oracle. Thanks to @taylorotwell.

Documentations
--------------

[](#documentations)

- You will find user-friendly and updated documentation here: [Laravel-OCI8 Docs](https://yajrabox.com/docs/laravel-oci8)
- All about oracle and php:[The Underground PHP and Oracle Manual](http://www.oracle.com/technetwork/database/database-technologies/php/201212-ug-php-oracle-1884760.pdf)

Laravel Version Compatibility
-----------------------------

[](#laravel-version-compatibility)

LaravelPackage5.1.x5.1.x5.2.x5.2.x5.3.x5.3.x5.4.x5.4.x5.5.x5.5.x5.6.x5.6.x5.7.x5.7.x5.8.x5.8.x6.x6.x7.x7.x8.x8.x9.x9.x10.x10.x11.x11.x12.x12.x13.x13.xQuick Installation
------------------

[](#quick-installation)

```
composer require yajra/laravel-oci8:^12
```

Service Provider (Optional on Laravel 5.5+)
-------------------------------------------

[](#service-provider-optional-on-laravel-55)

Once Composer has installed or updated your packages you need to register Laravel-OCI8. Open up `config/app.php` and find the providers key and add:

```
Yajra\Oci8\Oci8ServiceProvider::class,
```

Configuration (OPTIONAL)
------------------------

[](#configuration-optional)

Finally you can optionally publish a configuration file by running the following Artisan command. If config file is not publish, the package will automatically use what is declared on your `.env` file database configuration.

```
php artisan vendor:publish --tag=oracle
```

This will copy the configuration file to `config/oracle.php`.

> Note: For [Laravel Lumen configuration](http://lumen.laravel.com/docs/configuration#configuration-files), make sure you have a `config/database.php` file on your project and append the configuration below:

```
'oracle' => [
    'driver'         => 'oracle',
    'tns'            => env('DB_TNS', ''),
    'host'           => env('DB_HOST', ''),
    'port'           => env('DB_PORT', '1521'),
    'database'       => env('DB_DATABASE', ''),
    'service_name'   => env('DB_SERVICE_NAME', ''),
    'username'       => env('DB_USERNAME', ''),
    'password'       => env('DB_PASSWORD', ''),
    'charset'        => env('DB_CHARSET', 'AL32UTF8'),
    'prefix'         => env('DB_PREFIX', ''),
    'prefix_schema'  => env('DB_SCHEMA_PREFIX', ''),
    'edition'        => env('DB_EDITION', 'ora$base'),
    'server_version' => env('DB_SERVER_VERSION', '11g'),
    'load_balance'   => env('DB_LOAD_BALANCE', 'yes'),
    'dynamic'        => [],
    'max_name_len'   => env('ORA_MAX_NAME_LEN', 30),
],
```

> Then, you can set connection data in your `.env` files:

```
DB_CONNECTION=oracle
DB_HOST=oracle.host
DB_PORT=1521
DB_SERVICE_NAME=orcl
DB_DATABASE=xe
DB_USERNAME=hr
DB_PASSWORD=hr
```

> If you want to connect to a cluster containing multiple hosts, you can either set `tns` manually or set host as a comma-separated array and configure other fields as you wish:

```
DB_CONNECTION=oracle
DB_HOST=oracle1.host, oracle2.host
DB_PORT=1521
DB_SERVICE_NAME=orcl
DB_LOAD_BALANCE=no
DB_DATABASE=xe
DB_USERNAME=hr
DB_PASSWORD=hr
```

> If you need to connect with the service name instead of tns, you can use the configuration below:

```
'oracle' => [
    'driver' => 'oracle',
    'host' => 'oracle.host',
    'port' => '1521',
    'database' => 'xe',
    'service_name' => 'sid_alias',
    'username' => 'hr',
    'password' => 'hr',
    'charset' => '',
    'prefix' => '',
]
```

In some cases you may wish to set the connection parameters dynamically in your app. For instance, you may access more than one database, or your users may already have their own accounts on the Oracle database:

```
'oracle' => [
    'driver' => 'oracle',
    'host' => 'oracle.host',
    'port' => '1521',
    'service_name' => 'sid_alias',
    'prefix' => 'schemaowner',
    'dynamic' => [App\Models\Oracle\Config::class, 'dynamicConfig'],
]
```

The callback function in your app must be static and accept a reference to the `$config[]` array (which will already be populated with values set in the config file):

```
namespace App\Models\Oracle;

class Config {

    public static function dynamicConfig(&$config) {

        if (Illuminate\Support\Facades\Auth::check()) {
            $config['username'] = App\Oracle\Config::getOraUser();
            $config['password'] = App\Oracle\Config::getOraPass();
        }

    }
}
```

Then run your laravel installation...

Oracle versions
---------------

[](#oracle-versions)

To set this version use `DB_SERVER_VERSION` env variable or change `server_version` variable in the oracle.php config.

### 11g

[](#11g)

This is the baseline, if no version is set, this version is assumed.

### 12c

[](#12c)

- Use fetch/offset where possible instead of rownumber.
- In whereLike use `binary ci` for case insensitivity. ([\#945](https://github.com/yajra/laravel-oci8/pull/945))
- Use identity instead of seqvence/trigger for ids when using laravel's scheme builder. ([\#944](https://github.com/yajra/laravel-oci8/pull/944))

Oracle Max Name Length
----------------------

[](#oracle-max-name-length)

By default, DB object name are limited to 30 characters. To increase the limit, you can set the `ORA_MAX_NAME_LEN=128` in your `.env` file.

Note: this config requires **Oracle 12c02 or higher**.

\[Laravel 5.2++\] Oracle User Provider
--------------------------------------

[](#laravel-52-oracle-user-provider)

When using oracle, we may encounter a problem on authentication because oracle queries are case sensitive by default. By using this oracle user provider, we will now be able to avoid user issues when logging in and doing a forgot password failure because of case sensitive search.

To use, just update `auth.php` config and set the driver to `oracle`

```
'providers' => [
    'users' => [
        'driver' => 'oracle',
        'model' => App\User::class,
    ],
]
```

JSON support
------------

[](#json-support)

Laravel-OCI8 provides **read-only JSON** query support for Oracle databases.

> ⚠️This requires Oracle 12c02 or higher.

> ⚠️ JSON mutation / update operations are not supported. Only JSON filtering and querying are available.
> For JSON updates, the full JSON document must be modified in the application and saved back to the database.

Credits
-------

[](#credits)

- [Arjay Angeles](https://github.com/yajra)
- [Jimmy Felder](https://github.com/jfelder/Laravel-OracleDB)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

78

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity67

Solid adoption and visibility

Community44

Growing community involvement

Maturity98

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 83.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~5 days

Total

358

Last Release

62d ago

Major Versions

v11.6.4 → v12.0.02025-02-28

v11.6.5 → v12.1.62025-09-06

v11.6.6 → v12.1.82025-09-18

11.x-dev → v12.2.02025-12-08

12.x-dev → v13.0.02026-03-18

PHP version history (15 changes)0.1.0PHP &gt;=5.3.0

v2.0.0.betaPHP &gt;=5.4.0

v2.0.0PHP &gt;=5.4

v3.0.0PHP &gt;=5.5.9

v5.3.0PHP &gt;=5.6.4

v5.5.0PHP &gt;=7.0.0

v5.6.0PHP ^7.1.3

v6.0.0PHP ^7.2

v7.0.0PHP ^7.2.5

v8.0.0PHP ^7.3

v8.3.0PHP ^7.3|^8.0

v9.0.0PHP ^8.0.2

v10.0.0PHP ^8.1

v11.0.0PHP ^8.2

v13.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c245d1effe6022f9f09b2e8b9cce26743de03a64d612cea4ce9885560d7c0b2?d=identicon)[yajra](/maintainers/yajra)

---

Top Contributors

[![yajra](https://avatars.githubusercontent.com/u/2687997?v=4)](https://github.com/yajra "yajra (1124 commits)")[![csaba215](https://avatars.githubusercontent.com/u/11250204?v=4)](https://github.com/csaba215 "csaba215 (36 commits)")[![jonas-elias](https://avatars.githubusercontent.com/u/48037643?v=4)](https://github.com/jonas-elias "jonas-elias (21 commits)")[![ZsgsDesign](https://avatars.githubusercontent.com/u/19504567?v=4)](https://github.com/ZsgsDesign "ZsgsDesign (17 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (16 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (11 commits)")[![forgandenny](https://avatars.githubusercontent.com/u/2554234?v=4)](https://github.com/forgandenny "forgandenny (10 commits)")[![ChaosPower](https://avatars.githubusercontent.com/u/260845?v=4)](https://github.com/ChaosPower "ChaosPower (9 commits)")[![mfrancoisbbs](https://avatars.githubusercontent.com/u/133215273?v=4)](https://github.com/mfrancoisbbs "mfrancoisbbs (9 commits)")[![ErDiabIo](https://avatars.githubusercontent.com/u/35238519?v=4)](https://github.com/ErDiabIo "ErDiabIo (9 commits)")[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (9 commits)")[![masoudtajer](https://avatars.githubusercontent.com/u/49834756?v=4)](https://github.com/masoudtajer "masoudtajer (8 commits)")[![Xinguang](https://avatars.githubusercontent.com/u/2002838?v=4)](https://github.com/Xinguang "Xinguang (7 commits)")[![Adam2Marsh](https://avatars.githubusercontent.com/u/7213334?v=4)](https://github.com/Adam2Marsh "Adam2Marsh (6 commits)")[![jidago](https://avatars.githubusercontent.com/u/56063120?v=4)](https://github.com/jidago "jidago (6 commits)")[![hpacleb](https://avatars.githubusercontent.com/u/24486552?v=4)](https://github.com/hpacleb "hpacleb (5 commits)")[![MohammadMehrabani](https://avatars.githubusercontent.com/u/18621426?v=4)](https://github.com/MohammadMehrabani "MohammadMehrabani (5 commits)")[![wremon-yo](https://avatars.githubusercontent.com/u/174759679?v=4)](https://github.com/wremon-yo "wremon-yo (4 commits)")[![jfelder](https://avatars.githubusercontent.com/u/4504343?v=4)](https://github.com/jfelder "jfelder (4 commits)")[![mstaack](https://avatars.githubusercontent.com/u/10169509?v=4)](https://github.com/mstaack "mstaack (4 commits)")

---

Tags

hacktoberfestlaravellaravel-oci8oci8oraclephplaraveloracleoci8yajrapdo\_oci

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/yajra-laravel-oci8/health.svg)

```
[![Health](https://phpackages.com/badges/yajra-laravel-oci8/health.svg)](https://phpackages.com/packages/yajra-laravel-oci8)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
