2017 © Pedro Peláez
 

library session

PHP Session helper

image

tomkyle/session

PHP Session helper

  • Wednesday, March 12, 2014
  • by tomkyle
  • Repository
  • 1 Watchers
  • 4 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

tomkyle/session

Scrutinizer Quality Score, (*1)

A PHP Session helper that stores session data in sub-namespaces., (*2)

$_SESSION (PHP superglobal)
     |
     +-- SessionStorage (or derived class name)
            |
            +-- keyword (passed in instantiation)
                   |
                   +-- foo => bar
                   +-- key => value

Example

<?php
use \tomkyle\Session\SessionStorage;
use \MyNamepace\MySessionData;

class MySessionData extends SessionStorage {}

$namespace1 = new MySessionData( "keyword" );
$namespace1->foo = "bar";
$namespace1->key = "value";

$namespace2 = new MySessionData( "user" );
$namespace2->foo = "baz";
$namespace2->key = 2000;

$namespace3 = new SessionStorage( "keyword" );
$namespace3->foo = "anything";
$namespace3->key = "something";

// will both print "bar":
echo $namespace1->foo;
// compare old-school:
echo $_SESSION['MySessionData']['keyword']['foo'];

// will both print "baz":
echo $namespace2->foo;
// compare old-school:
echo $_SESSION['MySessionData']['user']['foo'];



// will both print "not the same"
echo ($namespace1->foo == $namespace2->foo)
? "samesame" : "not the same";

echo ($namespace2->foo == $namespace3->foo)
? "samesame" : "not the same";

The Versions

12/03 2014

dev-master

9999999-dev

PHP Session helper

  Sources   Download

by Carsten Witt

12/03 2014

1.0.2

1.0.2.0

PHP Session helper

  Sources   Download

by Carsten Witt

12/03 2014

dev-develop

dev-develop

PHP Session helper

  Sources   Download

by Carsten Witt

07/03 2014

1.0.0

1.0.0.0

PHP Session helper

  Sources   Download

by Carsten Witt