expressodev / laravel-codeigniter-db by adrianmacneil

Integration layer allowing use of the Laravel database library in CodeIgniter applications
4,005
29
5
Package Data
Maintainer Username: adrianmacneil
Maintainer Contact: adrian@adrianmacneil.com (Adrian Macneil)
Package Create Date: 2014-01-29
Package Last Update: 2017-08-08
Language: PHP
License: MIT
Last Refreshed: 2024-11-20 03:01:13
Package Statistics
Total Downloads: 4,005
Monthly Downloads: 3
Daily Downloads: 0
Total Stars: 29
Total Watchers: 5
Total Forks: 17
Total Open Issues: 4

Laravel CodeIgniter Database Integration

Build Status Latest Stable Version

This package allows you to use the excellent Laravel database library (illuminate/database) inside your CodeIgniter applications.

Laravel normally uses PDO to make database connections. CodeIgniter establishes its own connection to the database.

If you are only using the Laravel database components, then this will not be a problem - you can simply disable the CodeIgniter database connection and use Laravel's instead. However, if your application is using a mixture of CodeIgniter and Laravel database libraries, this is the package for you.

This integration layer takes all requests made to the Laravel database library, converts them to raw SQL, then passes them through to the underlying CodeIgniter database driver. This means that you will not need to establish two separate connections to the database, and it also means that CodeIgniter database profiling functions will continue to work correctly.

Usage

In your composer.json file:

{
    "require": {
        "expressodev/laravel-codeigniter-db": "~1.0"
    }
}

In your application:

// use our mock PDO class if PDO is not enabled on this server
if (!class_exists('PDO')) {
    class_alias('Illuminate\CodeIgniter\FakePDO', 'PDO');
}

// pass all Laravel database queries through to CodeIgniter
$ci = get_instance();
$resolver = new Illuminate\CodeIgniter\CodeIgniterConnectionResolver($ci);
Illuminate\Database\Eloquent\Model::setConnectionResolver($resolver);

License

MIT License