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

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

fkrfld/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.

10.0(1y ago)029MITPHPPHP ^8.0|^8.1|^8.2|^8.3

Since Dec 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fikrifalindi/laravel-db2)[ Packagist](https://packagist.org/packages/fkrfld/laravel-db2)[ RSS](/packages/fkrfld-laravel-db2/feed)WikiDiscussions 9.x Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

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

[](#laravel-db2)

[![Latest Stable Version](https://camo.githubusercontent.com/ddfaf60f7c28723babec9ad03ee0c5ced4eba565838776403d599ee03e140ffd/68747470733a2f2f706f7365722e707567782e6f72672f636f6f7065726c2f6c61726176656c2d6462322f762f737461626c65)](https://packagist.org/packages/cooperl/laravel-db2)[![Total Downloads](https://camo.githubusercontent.com/317c4a5bf9e6e081e51a17bc43859ade7748f9b7046ac52c98611aa0169f64ca/68747470733a2f2f706f7365722e707567782e6f72672f636f6f7065726c2f6c61726176656c2d6462322f646f776e6c6f616473)](https://packagist.org/packages/cooperl/laravel-db2)[![Latest Unstable Version](https://camo.githubusercontent.com/58a5583cde6cb7ba2974638ebe3ccf6c915b027b8c0f236993c63e9ff31bf459/68747470733a2f2f706f7365722e707567782e6f72672f636f6f7065726c2f6c61726176656c2d6462322f762f756e737461626c65)](https://packagist.org/packages/cooperl/laravel-db2)[![License](https://camo.githubusercontent.com/2778c08056b18b12f40194b484120e59f2f86424f94c4f87e9645f0934a76301/68747470733a2f2f706f7365722e707567782e6f72672f636f6f7065726c2f6c61726176656c2d6462322f6c6963656e7365)](https://packagist.org/packages/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.

This package is fork from [cooperl22/laravel-db2](https://github.com/cooperl22/laravel-db2)

---

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

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

[](#installation)

Add laravel-db2 to your composer.json file:

```
"require": {
    "cooperl/laravel-db2": "^10.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

31

—

LowBetter than 68% of packages

Maintenance45

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~103 days

Total

2

Last Release

411d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1b3ccb40baaf3c7c51d706d29a1ca5116f486638726e578b6f9d473943bda61?d=identicon)[fikrifalindi](/maintainers/fikrifalindi)

---

Top Contributors

[![cooperl22](https://avatars.githubusercontent.com/u/12048268?v=4)](https://github.com/cooperl22 "cooperl22 (32 commits)")[![fikrifalindi](https://avatars.githubusercontent.com/u/17400997?v=4)](https://github.com/fikrifalindi "fikrifalindi (6 commits)")[![sarahkemp](https://avatars.githubusercontent.com/u/2836313?v=4)](https://github.com/sarahkemp "sarahkemp (3 commits)")[![boivinj](https://avatars.githubusercontent.com/u/90038153?v=4)](https://github.com/boivinj "boivinj (2 commits)")[![lucasmezencio](https://avatars.githubusercontent.com/u/472412?v=4)](https://github.com/lucasmezencio "lucasmezencio (2 commits)")[![chrisdicarlo](https://avatars.githubusercontent.com/u/3483368?v=4)](https://github.com/chrisdicarlo "chrisdicarlo (1 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)")

---

Tags

laraveldatabasepdodb2odbc

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/fkrfld-laravel-db2/health.svg)](https://phpackages.com/packages/fkrfld-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.

58120.3k1](/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.

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

PHPackages © 2026

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