PHP code example of one23 / phalcon2laravel

1. Go to this page and download the library: Download one23/phalcon2laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

one23 / phalcon2laravel example snippets


$adapter = new \One23\Phalcon2laravel\Session\Adapter\Db([
    'db' => function() {
        $di = \Phalcon\Di\Di::getDefault();

        return $di->get('db');
    }, // lize_handler 
    'ip' => '127.0.0.1', // User IP. Default: $request->getClientAddress() 
    'user' => function() {
        return 1;
    }, // Closure with return user id (int). Default: null 
    'cookie_name' => 'laravel_session', // ddress() 
    'user' => function() {
        return 1;
    }, // Closure with return user id (int). Default: null 
    'laravel_key'    => 'abc123', // 

$sessionManager->existId('abc123'); // => bool

$sessionManager->generateCustomId(); // => 'eyJpdiI6IldBcGRIU2p...FnIjoiIn0='

$adapter->exist('abc123'); // => true 

$adapter->getCookieName(); // => 'laravel_session' 

$adapter->exist('eyJpdiI6IldBcGRIU2p...FnIjoiIn0='); // => true 

$adapter->decryptSessionId('eyJpdiI6IldBcGRIU2p...FnIjoiIn0='); // => 'abc123'

$adapter->encryptSessionId('abc123'); // => 'eyJpdiI6IldBcGRIU2p...FnIjoiIn0='

$adapter->isEncryptSessionId('eyJpdiI6IldBcGRIU2p...FnIjoiIn0='); // => true