2017 © Pedro Pelรกez
 

library session

Session Manager

image

skt-t1-byungi/session

Session Manager

  • Tuesday, November 8, 2016
  • by skt-t1-byungi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

SktT1Byungi/Session

PHP Session manager (with non blocking handler), (*1)

Latest Stable Version Total Downloads License, (*2)

Require

PHP 5.6 <= *, (*3)

Simple Example

use SktT1Byungi\Session\Session;

 Session::manager()->start();
 Session::set('aaa', '111');

 var_dump(Session::get('aaa') === $_SESSION['aaa']);
 // true

Usage

manager()

 Session::manager()->id("id")->name("name")->start();
 // session_id("id");
 // session_id("name");
 // session_start();

 Session::manager()->close()->destroy();
 // session_write_close();
 // session_destroy();

 Session::manager()->settings([
    'cookie_httponly' => true,
    'use_only_cookies' => true,
 ]);
 // ini_set("session.cookie_httponly", true);
 // ini_set("session.use_only_cookies", true);

 Session::manager()->handler(new CustomHandler)->start();
 // used custom handler

helpers

Session::set('aaa', [
    'bbb' => [
        'ccc' => 111,
        'ddd' => 222,
    ],
]);
Session::set('eee', '333');
Session::set('fff', '444');

echo Session::get('aaa.bbb.ccc');
// 111

var_dump(Session::has('ccc'), Session::has('eee'));
// false, true

var_dump(Session::only(['eee', 'fff']));
// ['eee' => '333', 'fff' => '444']

var_dump(Session::except(['aaa']));
// ['eee' => '333', 'fff' => '444']

Session::forget('aaa.bbb'); //or Session::remove('aaa.bbb');
// unset($_SESSION['aaa']['bbb']);

details links : https://laravel.com/docs/5.3/helpers#arrays, (*4)

collection

Session::set('aaa', [
    [
        "name" => "bangi",
        "position" => "god",
    ],
    [
        "name" => "faker",
        "position" => "human",
    ],
    [
        "name" => "duke",
        "position" => "human",
    ],
    [
        "name" => "wolf",
        "position" => "pig",
    ],
]);

var_dump(Session::collect('aaa')->where('position', 'human')->all());
// [
//     1 => [
//         "name" => "faker",
//         "position" => "human",
//     ],
//     2 => [
//         "name" => "duke",
//         "position" => "human",
//     ],
// ]

details links : https://laravel.com/docs/5.3/collections, (*5)

PSR-7 Middleware (__invoke, Closure)

when reaches the middleware point, session start., (*6)

Slim3 Example

$app->add(Session::manager()->handler(new CustomHandler)->id('mySess')->middleware());

etc..

session blocking(http://konrness.com/php5/how-to-prevent-blocking-php-requests/) ๋•Œ๋ฌธ์— ๊ดœ์ฐฎ์€ ํ•ธ๋“ค๋Ÿฌ ์ฐพ์•„๋ณด๋‹ค๊ฐ€ ๋จผ๊ฐ€ ์กฐ๊ธˆ์”ฉ๋“ค ์•„์‰ฌ์›Œ์„œ ๊ทธ๋ƒฅ ์ƒˆ๋กœ ๋งน๋“ฌ... ์„ธ์…˜๋ฝ๋ฌธ์ œ ์—†๊ณ  ๋‚˜์ค‘์— ํ•ธ๋“ค๋Ÿฌ๊ต์ฒด ๋˜๋ฉด์„œ ๊ธ€๋กœ๋ฒŒ์„ธ์…˜ ๋ณ€์ˆ˜ ์‚ฌ์šฉ๋„ ๊ฐ€๋Šฅํ•˜๋ฉด์„œ ๊ฐ„๋‹จํ•˜๊ณ  ๋˜ ์ปดํฌ์ €๋กœ ์“ธ์ˆ˜ ์žˆ๋Š”๊ฑธ๋กœ..., (*7)

The Versions

08/11 2016

dev-master

9999999-dev https://github.com/skt-t1-byungi/Session

Session Manager

  Sources   Download

MIT

The Requires

 

The Development Requires

non blocking session

08/11 2016

0.0.3

0.0.3.0 https://github.com/skt-t1-byungi/Session

Session Manager

  Sources   Download

MIT

The Requires

 

The Development Requires

non blocking session

30/09 2016

0.0.2

0.0.2.0 https://github.com/skt-t1-byungi/Session

Session Manager

  Sources   Download

MIT

The Requires

 

The Development Requires

non blocking session

24/09 2016

0.0.1

0.0.1.0 https://github.com/skt-t1-byungi/Session

Session Manager

  Sources   Download

MIT

The Requires

 

The Development Requires

non blocking session