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

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

emkcloud/laravel-iseries-db2
============================

Laravel Driver for DB2 on IBM iSeries

1.1.0(1mo ago)3586↓33.3%1MITPHP

Since May 7Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/emkcloud/laravel-iseries-db2)[ Packagist](https://packagist.org/packages/emkcloud/laravel-iseries-db2)[ Docs](https://github.com/emkcloud/laravel-iseries-db2)[ GitHub Sponsors](https://github.com/emkcloud)[ RSS](/packages/emkcloud-laravel-iseries-db2/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

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

[](#laravel-iseries-db2)

**Laravel Driver for DB2 on IBM iSeries (AS/400)**

A modern DB2 driver for Laravel, supporting IBM i (iSeries) systems using ODBC. This package is inspired by [db2-driver](https://github.com/BWICompanies/db2-driver), but due to significant changes introduced in Laravel 12, it was necessary to rebuild the driver from scratch. Designed for Laravel and IBM i &gt;= 7.1 release.

Features
--------

[](#features)

- Laravel ^12.0|^13.0
- Compatible with IBM iSeries DB2 &gt;= 7.1
- Compatible with `artisan db:table`
- Compatible with migration commands
- Using Laravel's modern Grammar
- Add Custom Laravel DB2 Methods
- Use only Query Builder, no Eloquent

Requirements
------------

[](#requirements)

- [IBM i Access ODBC (Windows &amp; Linux)](https://ibmi-oss-docs.readthedocs.io/en/latest/odbc/installation.html)
- [PHP PDO\_ODBC extension (Documentation)](https://www.php.net/manual/en/book.pdo.php)

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

[](#installation)

```
composer require emkcloud/laravel-iseries-db2
```

Configuration
-------------

[](#configuration)

- [Define connection in database.php](docs/contents/connection.md)
- [Define appropriate variables in .env](examples/variables.env)

Artisan Commands
----------------

[](#artisan-commands)

The following Laravel schema and database inspection commands have been tested and are fully supported by this driver with environment Laravel 12 and IBM iSeries 7.4:

```
// ✅ Artisan command support
php artisan db:show --database=iseries
php artisan db:show --database=iseries --counts
php artisan db:show --database=iseries --views

// ✅ Artisan command support
php artisan db:table --database=iseries
php artisan db:table --database=iseries MYTABLE

```

Example Output
--------------

[](#example-output)

- Screenshot of [`artisan db:table`](docs/images/artisan-table-columns.jpg)
- Screenshot of [`artisan db:show`](docs/images/artisan-table-show.jpg)
- Screenshot of [`artisan db:show --counts`](docs/images/artisan-table-count.jpg)
- Screenshot of [`artisan db:show --views`](docs/images/artisan-table-views.jpg)

Schema Commands
---------------

[](#schema-commands)

```
// ✅ Get all schemas for specific connection
Schema::connection('iseries')->getSchemas();

// ✅ Get all tables for default schema
Schema::connection('iseries')->getTables();
Schema::connection('iseries')->getTableListing();

// ✅ Get info columns table for default or specific schema
Schema::connection('iseries')->getColumns('MYTABLE');
Schema::connection('iseries')->getColumns('MYSCHEMA.MYTABLE');

// ✅ Get list columns table for default or specific schema
Schema::connection('iseries')->getColumnListing('MYTABLE');
Schema::connection('iseries')->getColumnListing('MYSCHEMA.MYTABLE');

// ✅ Get column type for specific table
Schema::connection('iseries')->getColumnType('MYTABLE','MYCOL');
Schema::connection('iseries')->getColumnType('MYSCHEMA.MYTABLE','MYCOL');

// ✅ Get info indexes table for default or specific schema
Schema::connection('iseries')->getIndexes('MYTABLE');
Schema::connection('iseries')->getIndexes('MYSCHEMA.MYTABLE');

// ✅ Get foreign keys table for default or specific schema
Schema::connection('iseries')->getForeignKeys('MYTABLE');
Schema::connection('iseries')->getForeignKeys('MYSCHEMA.MYTABLE');

// ✅ Get info views for default or specific schema
Schema::connection('iseries')->getViews();
Schema::connection('iseries')->getViews('MYSCHEMA');

// ✅ Check table existence for default or specific schema
Schema::connection('iseries')->hasTable('MYTABLE');
Schema::connection('iseries')->hasTable('MYSCHEMA.MYTABLE');

// ✅ Check column existence for specific table
Schema::connection('iseries')->hasColumn('MYTABLE','MYCOL')
Schema::connection('iseries')->hasColumn('MYSCHEMA.MYTABLE','MYCOL')

// ✅ Check columns existence for specific table
Schema::connection('iseries')->hasColumns('MYTABLE',['MYCOL1','MYCOLN'])
Schema::connection('iseries')->hasColumns('MYSCHEMA.MYTABLE',['MYCOL1','MYCOLN'])

// ✅ Check index existence for specific table
Schema::connection('iseries')->hasIndex('MYTABLE','MYINDEX')
Schema::connection('iseries')->hasIndex('MYSCHEMA.MYTABLE','MYINDEX')

// ✅ Check view existence for default or specific schema
Schema::connection('iseries')->hasView('MYVIEW')
Schema::connection('iseries')->hasView('MYSCHEMA.MYVIEW')
```

Custom DB2 Methods
------------------

[](#custom-db2-methods)

Retrieve a list of available IBM i libraries.

```
// ✅ Get list libraries presents in IBM iseries system
Schema::connection('iseries')->getSchemas();
Schema::connection('iseries')->getSchemasListing();

// ✅ Get list libraries presents in IBM iseries system
Schema::connection('iseries')->getLibraries();
Schema::connection('iseries')->getLibrariesListing();
```

This package adds convenient methods to execute remote IBM i programs.

```
// ✅ Runs a CALL select program with parameters
DB::connection('iseries')->executeSelect('MYLIBRARY.MYPROGRAM');
DB::connection('iseries')->executeSelect('MYLIBRARY.MYPROGRAM',[$PARM1,$PARM2]);

// ✅ Runs a CALL statement stored program with parameters
DB::connection('iseries')->executeStatement('MYLIBRARY/MYPROGRAM');
DB::connection('iseries')->executeStatement('MYLIBRARY/MYPROGRAM',[$PARM1,$PARM2]);
```

Migration Commands
------------------

[](#migration-commands)

```
// ✅ Creates a table with the given structure
DB::connection('iseries')->create(MYTABLESTRUCTURE);

// ✅ Drops a table if it exists (supports schema prefix)
DB::connection('iseries')->dropIfExists('MYTABLE');
DB::connection('iseries')->dropIfExists('MYSCHEMA/MYTABLE');
```

Migration Blueprint
-------------------

[](#migration-blueprint)

Laravel's Blueprint class offers a wide variety of methods for building database schemas. I focused on implementing the most essential and commonly used ones.

Migration Examples
------------------

[](#migration-examples)

- [Example verified commands](docs/contents/blueprint.md)
- [Example standard migration](examples/migration.php)

Migration Drop &amp; Rename
---------------------------

[](#migration-drop--rename)

To use Drop and Rename operations, the database connection user must have the correct permissions to execute the `ADDRPYLE` and `RMVRPYLE` commands. You can grant the necessary permissions by running the following commands on the IBM i system:

```
GRTOBJAUT OBJ(QSYS/ADDRPYLE) OBJTYPE(*CMD) USER(MYUSER) AUT(*USE)
GRTOBJAUT OBJ(QSYS/RMVRPYLE) OBJTYPE(*CMD) USER(MYUSER) AUT(*USE)
```

If an automatic reply to the `CPF32B2` message is configured directly on the central server, this warning can be ignored. If you enable automation on the central system, you must set the environment variable to false.

```
ISERIES_ODBC_REPLY_AUTOMATIC=false
```

Other Resources
---------------

[](#other-resources)

- [DB2 Connection String](https://www.ibm.com/docs/en/i/7.6.0?topic=details-connection-string-keywords)
- [Documentation PDO Attributes](https://www.php.net/manual/en/book.pdo.php)
- [IBM i Access Driver Release Notes](https://www.ibm.com/support/pages/ibm-i-access-acs-updates-pase)
- [Alternative Package db2driver](https://github.com/BWICompanies/db2-driver)
- [Documentation for DB2 for IBM i](https://www.ibm.com/docs/en/i/7.6.0?topic=concepts-database-files)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~319 days

Total

2

Last Release

49d ago

### Community

Maintainers

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

---

Top Contributors

[![emkcloud](https://avatars.githubusercontent.com/u/5731295?v=4)](https://github.com/emkcloud "emkcloud (8 commits)")

---

Tags

laraveldatabasepdodb2driverodbcas400ibmiSeries

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

ODBC Driver for Laravel 12+

28137.1k](/packages/dbt-odbc-driver)

PHPackages © 2026

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