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

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

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

2.0.2(10y ago)11.6kMITPHPPHP &gt;=5.4.0

Since Apr 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/michaelbonds/laravel-db2)[ Packagist](https://packagist.org/packages/michaelb/laravel-db2)[ RSS](/packages/michaelb-laravel-db2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

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

[](#laravel-db2)

This is a fork of [cooperl22's laravel-db2](https://www.github.com/cooperl22/laravel-db2)
-----------------------------------------------------------------------------------------

[](#this-is-a-fork-of-cooperl22s-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.

---

- [Installation](#installation)
- [Registering the Package](#registering-the-package)
- [Configuration](#configuration)
- [Usage](#usage)

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

[](#installation)

Add laravel-db2 to your composer.json file:

```
"require": {
    "michaelb/laravel-db2": "~2.0"
}

```

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

```
$ composer update

```

### Registering the Package

[](#registering-the-package)

Add the laravel-db2 Service Provider to your config in `app/config/app.php`:

```
'providers' => [
    MichaelB\Database\DB2\DB2ServiceProvider::class
],
```

### Configuration

[](#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 `app/config/database.php` (option 1) file or use package config file which you can be generated through command line by artisan (option 2).

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

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

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

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

    'odbc' => [
        'driver'         => 'odbc',
        'host'           => '',
        'database'       => '',
        'username'       => '',
        'password'       => '',
        'charset'        => 'utf8',
        'ccsid'          => 1208,
        'prefix'         => '',
        'schema'         => '',
        'i5_libl'        => '',
        'i5_lib'         => '',
        'i5_commit'      => 0,
        'i5_naming'      => 0,
        'i5_date_fmt'    => 5,
        'i5_date_sep'    => 0,
        'i5_decimal_sep' => 0,
        'i5_time_fmt'    => 0,
        'i5_time_sep'    => 0,
        'options'  => [
            PDO::ATTR_CASE => PDO::CASE_LOWER,
            PDO::ATTR_EMULATE_PREPARES => false,
            PDO::ATTR_PERSISTENT => false
            ]
    ],

    'ibm' => [
        'driver'         => 'ibm',
        'host'           => '',
        'database'       => '',
        'username'       => '',
        'password'       => '',
        'charset'        => 'utf8',
        'ccsid'          => 1208,
        'prefix'         => '',
        'schema'         => '',
        'i5_libl'        => '',
        'i5_lib'         => '',
        'i5_commit'      => 0,
        'i5_naming'      => 0,
        'i5_date_fmt'    => 5,
        'i5_date_sep'    => 0,
        'i5_decimal_sep' => 0,
        'i5_time_fmt'    => 0,
        'i5_time_sep'    => 0,
        'options'  => [
            PDO::ATTR_CASE => PDO::CASE_LOWER,
            PDO::ATTR_EMULATE_PREPARES => false,
            PDO::ATTR_PERSISTENT => false
        ]
    ],
```

driver setting is either 'odbc' for ODBC connection or 'ibm' for pdo\_ibm connection Then if driver is 'odbc', database must be set to ODBC connection name. if driver is '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 config:publish michaelb/laravel-db2

```

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

Usage
-----

[](#usage)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 81.8% 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 ~16 days

Total

4

Last Release

3984d ago

Major Versions

1.0 → 2.02015-05-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/4602a1d28c96abf84256424cd552349c5a0f4f5c507fa5ed7df380b7133fd6ac?d=identicon)[infeloper](/maintainers/infeloper)

---

Top Contributors

[![michaelbonds](https://avatars.githubusercontent.com/u/2603881?v=4)](https://github.com/michaelbonds "michaelbonds (9 commits)")[![cooperl22](https://avatars.githubusercontent.com/u/12048268?v=4)](https://github.com/cooperl22 "cooperl22 (2 commits)")

---

Tags

laraveldatabasepdodb2odbc

### Embed Badge

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

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