konkon1234 / laravel-native-session-bridge by konkon1234

session bridge for laravel5 to native php script.
50
0
1
Package Data
Maintainer Username: konkon1234
Maintainer Contact: konkon1234@gmail.com (Kouji Nomura)
Package Create Date: 2017-02-28
Package Last Update: 2017-05-21
Language: PHP
License: MIT
Last Refreshed: 2025-02-07 15:04:10
Package Statistics
Total Downloads: 50
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

laravel native session bridge

This library allows for bidirectional reading and writing of the Laravel application of Session management using Mysql Database and the $_SESSION object of Native php.

Support Version

  • php 5.6 or higher
  • Laravel 5.3, 5.4

Usage

set session handler.

example.

$handler = new \Konkon1234\LaravelNativeSessionBridge\LaravelFormatSessionHandlerClient($pdo, $db_name, [
    // Give the same settings as Laravel

    'table' => 'sessions',
    'encrypt' => false,
    'app_key' => null,
    'cipher' => 'AES-256-CBC',
    'cookie' => 'laravel_session',
    'lifetime' => 120,
    'path' => '/',
    'domain' => null,
    'secure' => false,
    'http_only' => true,
]);

ini_set('session.serialize_handler', 'php_serialize'); // require
session_name('laravel_session'); // require
session_set_save_handler($handler, false); // require register_shutdown is false.

session_start();

// You can get the value set in Laravel from $ _SESSION
// $request->session()->put('from_laravel', 'message from laravel');
echo $_SESSION['from_laravel'];

// Once you have set a value for the native session object, you can retrieve it with Laravel
// $request->session()->get('from_native');
$_SESSION['from_native'] = 'message from native';


How to install

composer require konkon1234/laravel-native-session-bridge

Lisence

MIT Lisence