alexdin/yii2-file-session

There is no license information available for the latest version (0.0.2) of this package.

Extention Class for Yii2 File Session based on yii/web/Session

0.0.2 2017-08-21 21:10 UTC

This package is auto-updated.

Last update: 2024-05-12 22:40:42 UTC


README

PHP Yii2. This is an expanding class of web sessions . This class supports retrieving data on session id and deleting it.

Installation

php composer.phar require --prefer-dist alexdin/yii2-file-session

or add

"alexdin/yii2-file-session":"^0.0.2"

Configure

Configure file session add this string to components in config main.php file (main-local.php).

 'session' => [
             // this is the name of the session cookie used for login on the backend
             'class'=>'alexdin\filesession\Session',
             'name' => 'session-name',
             // dir for your path session
             // create migrate if dir is not exists or use "mkdir" function
             'savePath' => __DIR__ . '/../runtime/sessions',
         ],

Usage

Yii::$app->session->destroySession($id)

Clears and deletes the session by id

Yii::$app->session->readSession($id)

Reads the session from the file and returns the serialized data in the string

Yii::$app->session->getSessionData($id)

Returns an array of session data by id

Yii::$app->session->getSessionFileName($id)

Returns the session file name by id