PHP code example of michalsn / codeigniter-session-extended

1. Go to this page and download the library: Download michalsn/codeigniter-session-extended 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/ */

    

michalsn / codeigniter-session-extended example snippets




namespace Config;

use CodeIgniter\Config\AutoloadConfig;

class Autoload extends AutoloadConfig
{
    // ...
    public $psr4 = [
        APP_NAMESPACE => APPPATH, // For custom app namespace
        'Config'      => APPPATH . 'Config',
        'Michalsn\CodeIgniterSessionExtended' => APPPATH . 'ThirdParty/session-extended/src',
    ];

    // ...



namespace Config;

use CodeIgniter\Config\BaseConfig;
use Michalsn\SessionExtended\DatabaseHandler;

class Session extends BaseConfig
{
    // ...
    public string $driver = DatabaseHandler::class;

    // ...
    public string $savePath = 'ci_sessions';

    // ...
}

// app/Controllers/Home.php


namespace App\Controllers;

use CodeIgniter\Exceptions\PageNotFoundException;
use Michalsn\CodeIgniterSessionExtended\SessionManager;

class Sessions extends BaseController
{
    public function index()
    {
        $sm = new SessionManager();

        $data['sessions'] = $sm->list(user_id());

        return view('sessions/index', $data);
    }

    public function delete()
    {
        if (! $this->request->is('post')) {
            throw new PageNotFoundException();
        }

        $rules = [
            'id' => ['
cli
php spark se:install