PHPackages                             anzims/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. anzims/laravel-oci8

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

anzims/laravel-oci8
===================

Oracle DB driver for Laravel via OCI8

v11.6.4(1y ago)02MITPHPPHP ^8.2

Since Jan 15Pushed 1y agoCompare

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

READMEChangelogDependencies (8)Versions (329)Used By (0)

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

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

[![Build Status](https://github.com/yajra/laravel-oci8/workflows/tests/badge.svg)](https://github.com/yajra/laravel-oci8/actions)[![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.xQuick Installation
------------------

[](#quick-installation)

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

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 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,
    ],
]
```

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

42

—

FairBetter than 90% of packages

Maintenance41

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity95

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 87.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 ~38 days

Total

324

Last Release

497d ago

Major Versions

v9.5.2 → v10.4.02024-01-24

v9.5.3 → v10.4.22024-02-03

v10.5.2 → v11.0.02024-03-16

v10.5.3 → v11.2.42024-05-22

9.x-dev → v11.4.02024-07-13

PHP version history (14 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

### Community

Maintainers

![](https://www.gravatar.com/avatar/26e0da1373efd196bc5c9722cf3eb0d7538778cf806431137060bc9759522e61?d=identicon)[anzims](/maintainers/anzims)

---

Top Contributors

[![yajra](https://avatars.githubusercontent.com/u/2687997?v=4)](https://github.com/yajra "yajra (979 commits)")[![ZsgsDesign](https://avatars.githubusercontent.com/u/19504567?v=4)](https://github.com/ZsgsDesign "ZsgsDesign (17 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)")[![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)")[![Adam2Marsh](https://avatars.githubusercontent.com/u/7213334?v=4)](https://github.com/Adam2Marsh "Adam2Marsh (6 commits)")[![MohammadMehrabani](https://avatars.githubusercontent.com/u/18621426?v=4)](https://github.com/MohammadMehrabani "MohammadMehrabani (5 commits)")[![mstaack](https://avatars.githubusercontent.com/u/10169509?v=4)](https://github.com/mstaack "mstaack (4 commits)")[![hpacleb](https://avatars.githubusercontent.com/u/24486552?v=4)](https://github.com/hpacleb "hpacleb (4 commits)")[![jaydons](https://avatars.githubusercontent.com/u/44308248?v=4)](https://github.com/jaydons "jaydons (4 commits)")[![wremon-yo](https://avatars.githubusercontent.com/u/174759679?v=4)](https://github.com/wremon-yo "wremon-yo (4 commits)")[![jidago](https://avatars.githubusercontent.com/u/56063120?v=4)](https://github.com/jidago "jidago (4 commits)")[![jfelder](https://avatars.githubusercontent.com/u/4504343?v=4)](https://github.com/jfelder "jfelder (4 commits)")[![OmarAta](https://avatars.githubusercontent.com/u/9981596?v=4)](https://github.com/OmarAta "OmarAta (3 commits)")[![rhernandezOB](https://avatars.githubusercontent.com/u/135292745?v=4)](https://github.com/rhernandezOB "rhernandezOB (3 commits)")[![mozgovoyandrey](https://avatars.githubusercontent.com/u/2863373?v=4)](https://github.com/mozgovoyandrey "mozgovoyandrey (3 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (2 commits)")

---

Tags

laraveloracleoci8yajrapdo\_oci

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8703.0M17](/packages/yajra-laravel-oci8)[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)
