jtgrimes/laravel-db2-bridge

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Brings Laravel's database tools and Eloquent models to db2

dev-master 2017-09-13 19:10 UTC

This package is not auto-updated.

Last update: 2021-11-27 11:51:11 UTC


README

Use Laravel's database and Eloquent tools on DB2 with no fuss

:WARNING: Heads Up :WARNING:

This is a very very preliminary release of this package and should be used at your own risk. The code here does everything I need it to, but does not yet fully implement Laravel's database or Eloquent components. Suggestions are gratefully accepted. Pull Requests are even more gratefully accepted.

License

LaravelDB2Bridge is open-sourced software licensed under the MIT license, the same license Laravel uses.

Requirements

LaravelDB2Bridge wraps PHP's native db2_* database functions to be called from Laravel. You must have the ibm_db2 extension installed to use this package.

Installation

Via Composer

$ composer require jtgrimes\laravel-db2-bridge

Once Composer has installed or updated your packages, you need to register LaravelDB2Bridge with Laravel itself. Open up /config/app.php and find the providers key towards the bottom and add:

'JTGrimes\LaravelDB2\DB2ServiceProvider'

Configuration

When you use LaravelDB2Bridge, DB2 becomes just another database driver in Laravel. To configure your database, open /config/database.php and add the following to the connections array:

     'db2' => [
         'username'   => env('DB_USERNAME'),
         'password' => env('DB_PASSWORD'),
         'dbname'   => '*LOCAL',
         'options' => [
             'i5_libl' => 'QTEMP OTHERLIB ANOTHEROTHERLIB',
             'i5_naming' => 'DB2_I5_NAMING_OFF',
             ...
          ],
     ],

Obviously, you can tweak those settings to suit your needs. All of the connection options are available and can be set in the options array.

Usage

Use Laravel's database and Eloquent packages as you usually would.

Credits

Taylor Otwell wrote Laravel which is awesome, but he shares no blame for this package. Alan Seiden deserves a little blame for encouraging me to release this package. If you're running PHP on the IBM iSeries, he's the guy to hit up for help.