kodi-app / kodi-session
KodiApp Session
v0.9.1
2017-10-01 22:28 UTC
Requires
- php: ^7.1
- kodi-app/kodi-core: v0.9.*
- nagyatka/pandabase: v0.20.*
- symfony/http-foundation: v3.3.*
Requires (Dev)
- phpunit/phpunit: 5.4.8
This package is not auto-updated.
Last update: 2025-03-08 03:31:44 UTC
README
This repository contains different Session implementation for KodiApp.
Installation
$ composer require kodi-app/kodi-session
Configure SessionHook
PandabaseSessionHook
PandabaseSessionHook implementation is based on Symfony's PdoSessionHandler.
$application->run([ // ... KodiConf::HOOKS => [ // ... [ "class_name" => PandabaseSessionHook::class, "parameters" => [ // Optional, you have to set it when you have more Connection instance in ConnectionManager "connection_name" => "default", // Optional, 'options' parameter is same as PdoSessionHandler's 'options' parameter "options" => [ // ... ] ] ], // ... ], // ... ]);
You find details about PdoSessionHandler here.
You find details about Pandabase here.
Configure SessionProvider
$application->run([ KodiConf::SERVICES => [ SessionProvider::class ] ]);
How to use SessionProvider
/** @var Session $session */ $session = Application::get("session") // Get username value from session (same as $_SESSION["username"]). If it doesnt exist returns with "anon". $username = $session->get("username","anon") // Set a new username $new_username = "john_doe"; $session->set("username",$new_username);