2017 © Pedro Peláez
 

library codeigniter_migration

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5

image

ci2lara/codeigniter_migration

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5

  • Monday, December 11, 2017
  • by neo79a
  • Repository
  • 1 Watchers
  • 0 Stars
  • 68 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 3 Versions
  • 11 % Grown

The README.md

CodeigniterMigration To Laravel

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5., (*1)

Requirements

  • Laravel >= 5
  • PHP >=5.3
  • Codeigniter 2.x (not tested with 3.x)

The package includes ServiceProvider and Facade for easy Laravel integration. This is particularly useful if you want to slowly migrate legacy code to laravel and Codeigniter is still responsible for the Login & Authentication. You can read out the Userdata-Values of the current Codeigniter-session (via cookie-handling)., (*2)

Installation

Require this package with composer:, (*3)

composer require ci2lara/codeigniter_migration

After updating composer (composer update), add the ServiceProvider to the providers array in config/app.php, (*4)

Service Provider

In your app config, add the CodeigniterServiceProvider to the providers array., (*5)

'providers' => [
   ...
    'Ci2Lara\Codeigniter_Migration\Providers\CodeigniterServiceProvider',
   ...
    ];

Facade

You have to use the facade, add it to the aliases array in your app config, (*6)

'aliases' => [
   ...
    'CodeigniterSession' => 'Ci2Lara\Codeigniter_Migration\Facades\CodeigniterSession',  
   ...
    ];

Configuration (e.g. CI-Cookie-Name)

Copy the package config to your local config with the publish command:, (*7)

php artisan vendor:publish

To change the configuration, uncomment the values (e.g. sess_table_name or sess_cookie_name) in the new config/ci_session.php, (*8)

Set up the Middleware to read the session

You should only use unencrypted cookies in codeigniter - so Laravel can directly access to the cookie. Because of security-reasons you have to allow Laravel to use this unencrypted Cookie., (*9)

Change the following Line in your app/Http/Kernel.php in the "$middleware"-Array, (*10)

'Illuminate\Cookie\Middleware\EncryptCookies'

to, (*11)

'Ci2Lara\Codeigniter_Migration\Middleware\EncryptCookies'

The Package-Middleware only disable the Cookie-Encryption for the configured Cookie-Name only (Default: ci_session, see config/ci_session.php), (*12)

Access to the Codeigniter Session in Laravel 5

Shortly: CodeigniterSession::getUserData(), (*13)

e.g., (*14)

\View::share('userdata', CodeigniterSession::getUserData());

Access to some Project-Config-Variables or CI-Config-Variables

You can expand your CI-Code, (*15)

e.g. in your CodeIgniter-Login-Handling, (*16)

$userdata['ci_config'] = array('version' => '1.0', 'module_xy_enabled' => $this->config->item('modul_xy_enabled'), 'yourconfig' => 'some value');
$CI->session->set_userdata($userdata);

In Laravel you can simply access with the following code:, (*17)

CodeigniterSession::getConfigData()->version

Try it out, (*18)

dd(CodeigniterSession::getConfigData());

Contributing

Contributions to the CodeigniterMigration are welcome. Please note the following guidelines before submiting your pull request., (*19)

  • Follow PSR-2 coding standards.

License

CodeigniterMigration is licensed under the MIT License., (*20)

Copyright 2015 [Andreas Schwinger], (*21)

The Versions

11/12 2017

dev-master

9999999-dev

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5

  Sources   Download

MIT

The Requires

 

by Andreas Schwinger

laravel migration codeigniter ci session

16/10 2015

v0.1.1

0.1.1.0

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5

  Sources   Download

MIT

The Requires

 

by Andreas Schwinger

laravel migration codeigniter ci session

15/10 2015

v0.1

0.1.0.0

CodeigniterMigration is a package to integrate an already started Codeigniter-Session in Laravel 5

  Sources   Download

MIT

The Requires

 

by Andreas Schwinger

laravel codeigniter ci session