kkszymanowski/laravel-6-firebird

A Firebird database package for Laravel 6
20,453 30
Install
composer require kkszymanowski/laravel-6-firebird
Latest Version:6.0.6
PHP:>=7.2.0
Laravel:6 – 9
License:MIT
Last Updated:Mar 28, 2022
Links: GitHub  ·  Packagist
Maintainer: KKSzymanowski

Firebird database driver for Laravel 6, 7, 8 and 9.

Package inspired by jacquestvanzuydam/laravel-firebird but simplified, modernized and made compatible with Laravel 6, 7 and 8.

I do not create my own Firebird databases, only read from existing ones so the INSERT and UPDATE support may be spotty.

Installation

composer require kkszymanowski/laravel-6-firebird

Add you database configuration in config/database.php

'connections' => [
    'myFirebirdConnection' => [
        'driver'   => 'firebird',
        'host'     => env('DB_FIREBIRD_HOST', 'localhost'),
        'port'     => env('DB_FIREBIRD_PORT', '3050'),
        'database' => env('DB_FIREBIRD_DATABASE', '/path_to/database.fdb'),
        'username' => env('DB_FIREBIRD_USERNAME', 'SYSDBA'),
        'password' => env('DB_FIREBIRD_PASSWORD', 'masterkey'),
        'charset'  => env('DB_FIREBIRD_CHARSET', 'UTF8'),
    ],

    // ...
],

Add the DB_FIREBIRD_* environment variables to your .env file, for example:

DB_FIREBIRD_HOST=192.168.0.1
DB_FIREBIRD_PORT=3050
DB_FIREBIRD_DATABASE=C:/DB.FDB
DB_FIREBIRD_USERNAME=user
DB_FIREBIRD_PASSWORD=password
DB_FIREBIRD_CHARSET=ISO-8859-2

Usage

Eloquent as model

To override your default database connection define $connection name in your Eloquent Model

/**
 * The connection name for the model.
 *
 * @var string
 */
protected $connection = 'myFirebirdConnection';

After defining connection name you can use it in normal way as you use Eloquent:

$user = User::where('id', 1)->get();

$users = User::all();
DB Query

Each time you have to define connection name (if it isn't your default one), for example:

$sql = 'SELECT * FROM USERS WHERE id = :id';
$bindings = ['id' => 1];
$user = DB::connection('myFirebirdConnection')->select($sql, $bindings);

$users = DB::connection('myFirebirdConnection')->table('USERS')->select('*')->get();

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
6.0.6 >=7.2.0 >=6.0 MIT
6.0.5 >=7.2.0 ^6.0|^7.0|^8.0 MIT
6.0.4 >=7.2.0 ^6.0|^7.0|^8.0 MIT
6.0.3 ^7.2 ^6.0|^7.0|^8.0 MIT
6.0.2 ^7.2 ^6.0|^7.0 MIT