PHPackages                             rb-serin/laravel-db2 - 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. rb-serin/laravel-db2

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

rb-serin/laravel-db2
====================

laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.

v1.0.3(1y ago)02MITPHPPHP ^8.0

Since Mar 26Pushed 1y agoCompare

[ Source](https://github.com/rb-serin/laravel-db2)[ Packagist](https://packagist.org/packages/rb-serin/laravel-db2)[ RSS](/packages/rb-serin-laravel-db2/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (5)Used By (0)

laravel-db2
===========

[](#laravel-db2)

[![Latest Stable Version](https://camo.githubusercontent.com/0d36f1bd264c238a9f1f3cb65e38aba46b3109bb773dd93c503add27c201625f/68747470733a2f2f706f7365722e707567782e6f72672f72622d736572696e2f6c61726176656c2d6462322f762f737461626c65)](https://packagist.org/packages/rb-serin/laravel-db2)[![Total Downloads](https://camo.githubusercontent.com/18bdcea39ea810f95d254eefbb9e18133a0d1a70da3980f9fbd100044cee861c/68747470733a2f2f706f7365722e707567782e6f72672f72622d736572696e2f6c61726176656c2d6462322f646f776e6c6f616473)](https://poser.pugx.org/rb-serin/laravel-db2)[![Latest Unstable Version](https://camo.githubusercontent.com/a2f2ce65e4a1ba56c2b97ad7660a59d06ec4601ab8c681aa13724c207d0b1503/68747470733a2f2f706f7365722e707567782e6f72672f72622d736572696e2f6c61726176656c2d6462322f762f756e737461626c65)](https://poser.pugx.org/rb-serin/laravel-db2)[![License](https://camo.githubusercontent.com/d46c5516268a63ed5eff29f5856a04f9d11de4c4407b40718d84c19f02856425/68747470733a2f2f706f7365722e707567782e6f72672f72622d736572696e2f6c61726176656c2d6462322f6c6963656e7365)](https://camo.githubusercontent.com/d46c5516268a63ed5eff29f5856a04f9d11de4c4407b40718d84c19f02856425/68747470733a2f2f706f7365722e707567782e6f72672f72622d736572696e2f6c61726176656c2d6462322f6c6963656e7365)

Forked from [cooperl/laravel-db2](https://github.com/cooperl22/laravel-db2)

Laravel 12 compatible (no minor versions because Illuminate\\Database changes.

Fixed broken migrations.

Help very much appreciated.

---

laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.

---

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)

Installation
------------

[](#installation)

Add laravel-db2 to your composer.json file:

```
"require": {
    "RbSerin/laravel-db2": "^1.0"
}

```

Use [composer](https://getcomposer.org) to install this package.

```
$ composer update

```

### Database Configuration

[](#database-configuration)

There are two ways to configure laravel-db2. You can choose the most convenient way for you. You can put your DB2 credentials into `config/database.php` (option 1) file or use package config file which you can generate through command line by artisan (option 2).

Please check appropriate specific DSN parameters for your connection. For instance here are the ODBC keywords for IBMi [https://www.ibm.com/support/knowledgecenter/fr/ssw\_ibm\_i\_74/rzaik/connectkeywords.htm](https://www.ibm.com/support/knowledgecenter/fr/ssw_ibm_i_74/rzaik/connectkeywords.htm)

If you encounter issues with char fields containing characters outside the invariant character set (for example: "ü") in PHP applications using the UTF8 locale the workaround to prevent the extra garbage data is to set the following connection string keyword: `DEBUG = 65536`

#### Option 1: Configure DB2 using `config/database.php` file

[](#option-1-configure-db2-using-configdatabasephp-file)

Simply add this code at the end of your `config/database.php` file:

```
    /*
    |--------------------------------------------------------------------------
    | DB2 Databases
    |--------------------------------------------------------------------------
    */

    'ibmi' => [
        'driver' => 'db2_ibmi_odbc',
        // or 'db2_ibmi_ibm' / 'db2_zos_odbc' / 'db2_expressc_odbc
        'driverName' => '{IBM i Access ODBC Driver}',
        // or '{iSeries Access ODBC Driver}' / '{IBM i Access ODBC Driver 64-bit}'
        'host' => 'server',
        'username' => '',
        'password' => '',
        'database' => 'WRKRDBDIRE entry',
        'prefix' => '',
        'schema' => 'default schema',
        'port' => 50000,
        'date_format' => 'Y-m-d H:i:s',
        // or 'Y-m-d H:i:s.u' / 'Y-m-d-H.i.s.u'...
        'odbc_keywords' => [
            'SIGNON' => 3,
            'SSL' => 0,
            'CommitMode' => 2,
            'ConnectionType' => 0,
            'DefaultLibraries' => '',
            'Naming' => 0,
            'UNICODESQL' => 0,
            'DateFormat' => 5,
            'DateSeperator' => 0,
            'Decimal' => 0,
            'TimeFormat' => 0,
            'TimeSeparator' => 0,
            'TimestampFormat' => 0,
            'ConvertDateTimeToChar' => 0,
            'BLOCKFETCH' => 1,
            'BlockSizeKB' => 32,
            'AllowDataCompression' => 1,
            'CONCURRENCY' => 0,
            'LAZYCLOSE' => 0,
            'MaxFieldLength' => 15360,
            'PREFETCH' => 0,
            'QUERYTIMEOUT' => 1,
            'DefaultPkgLibrary' => 'QGPL',
            'DefaultPackage' => 'A /DEFAULT(IBM),2,0,1,0',
            'ExtendedDynamic' => 0,
            'QAQQINILibrary' => '',
            'SQDIAGCODE' => '',
            'LANGUAGEID' => 'ENU',
            'SORTTABLE' => '',
            'SortSequence' => 0,
            'SORTWEIGHT' => 0,
            'AllowUnsupportedChar' => 0,
            'CCSID' => 819,
            'GRAPHIC' => 0,
            'ForceTranslation' => 0,
            'ALLOWPROCCALLS' => 0,
            'DB2SQLSTATES' => 0,
            'DEBUG' => 0,
            'TRUEAUTOCOMMIT' => 0,
            'CATALOGOPTIONS' => 3,
            'LibraryView' => 0,
            'ODBCRemarks' => 0,
            'SEARCHPATTERN' => 1,
            'TranslationDLL' => '',
            'TranslationOption' => 0,
            'MAXTRACESIZE' => 0,
            'MultipleTraceFiles' => 1,
            'TRACE' => 0,
            'TRACEFILENAME' => '',
            'ExtendedColInfo' => 0,
        ],
        'options' => [
            PDO::ATTR_CASE => PDO::CASE_LOWER,
            PDO::ATTR_PERSISTENT => false
        ]
        + (defined('PDO::I5_ATTR_DBC_SYS_NAMING') ? [PDO::I5_ATTI5_ATTR_DBC_SYS_NAMINGR_COMMIT => false] : [])
        + (defined('PDO::I5_ATTR_COMMIT') ? [PDO::I5_ATTR_COMMIT => PDO::I5_TXN_NO_COMMIT] : [])
        + (defined('PDO::I5_ATTR_JOB_SORT') ? [PDO::I5_ATTR_JOB_SORT => false] : [])
        + (defined('PDO::I5_ATTR_DBC_LIBL') ? [PDO::I5_ATTR_DBC_LIBL => ''] : [])
        + (defined('PDO::I5_ATTR_DBC_CURLIB') ? [PDO::I5_ATTR_DBC_CURLIB => ''] : [])
    ],
```

driver setting can be:

- 'db2\_ibmi\_odbc' for IBMi ODBC connection
- 'db2\_ibmi\_ibm' for IBMi PDO\_IBM connection
- 'db2\_zos\_odbc' for zOS ODBC connection
- 'db2\_expressc\_odbc for Express-C ODBC connection

Then if driver is 'db2\_\*\_odbc', database must be set to ODBC connection name. if driver is 'db2\_ibmi\_ibm', database must be set to IBMi database name (WRKRDBDIRE).

#### Option 2: Configure DB2 using package config file

[](#option-2-configure-db2-using-package-config-file)

Run on the command line from the root of your project:

```
$ php artisan vendor:publish

```

Set your laravel-db2 credentials in `config/db2.php`the same way as above

### Queue Configuration

[](#queue-configuration)

Simply set database connection driver value to `'db2_odbc'` in `config/queue.php` file:

Usage
-----

[](#usage)

Consult the [Laravel framework documentation](https://laravel.com/docs).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance43

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 59.3% 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 ~5 days

Total

4

Last Release

449d ago

PHP version history (3 changes)v1.0.0PHP ^7.3|^8.3

v1.0.1PHP ^8.0|^8.1|^8.2|^8.3

v1.0.2PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46899988?v=4)[Roberto](/maintainers/rb-serin)[@rb-serin](https://github.com/rb-serin)

---

Top Contributors

[![cooperl22](https://avatars.githubusercontent.com/u/12048268?v=4)](https://github.com/cooperl22 "cooperl22 (32 commits)")[![rb-serin](https://avatars.githubusercontent.com/u/46899988?v=4)](https://github.com/rb-serin "rb-serin (12 commits)")[![sarahkemp](https://avatars.githubusercontent.com/u/2836313?v=4)](https://github.com/sarahkemp "sarahkemp (3 commits)")[![lucasmezencio](https://avatars.githubusercontent.com/u/472412?v=4)](https://github.com/lucasmezencio "lucasmezencio (2 commits)")[![boivinj](https://avatars.githubusercontent.com/u/90038153?v=4)](https://github.com/boivinj "boivinj (2 commits)")[![mfrancisc](https://avatars.githubusercontent.com/u/10716933?v=4)](https://github.com/mfrancisc "mfrancisc (1 commits)")[![bironeaj](https://avatars.githubusercontent.com/u/16939160?v=4)](https://github.com/bironeaj "bironeaj (1 commits)")[![chrisdicarlo](https://avatars.githubusercontent.com/u/3483368?v=4)](https://github.com/chrisdicarlo "chrisdicarlo (1 commits)")

---

Tags

laraveldatabasepdodb2odbc

### Embed Badge

![Health badge](/badges/rb-serin-laravel-db2/health.svg)

```
[![Health](https://phpackages.com/badges/rb-serin-laravel-db2/health.svg)](https://phpackages.com/packages/rb-serin-laravel-db2)
```

###  Alternatives

[cooperl/laravel-db2

laravel-db2 is a simple DB2 service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework.

58125.1k1](/packages/cooperl-laravel-db2)[cooperl/laravel-ibmi

laravel-ibmi is a simple DB2 &amp; Toolkit for IBMi service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework. Plus it also provides Toolkit for IBMi so that you can access IBMi resources with same credentials.

1015.6k](/packages/cooperl-laravel-ibmi)

PHPackages © 2026

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