Package Data | |
---|---|
Maintainer Username: | codezero |
Maintainer Contact: | ivan@codezero.be (Ivan Vermeyen) |
Package Create Date: | 2015-03-29 |
Package Last Update: | 2015-03-29 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:22:14 |
Package Statistics | |
---|---|
Total Downloads: | 2,817 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 4 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package includes an adapter for Laravel's Session Store
, to enable the use of other implementations in non-Laravel projects.
Install this package through Composer:
composer require codezero/session
Autoload the vendor classes:
require_once 'vendor/autoload.php'; // Path may vary
And then use the VanillaSession
implementation:
$session = new \CodeZero\Session\VanillaSession();
Add a reference to LaravelSessionServiceProvider
to the providers array in config/app.php
:
'providers' => [
'CodeZero\Session\LaravelSessionServiceProvider'
]
Then you can "make" (or inject) a Cookie
instance anywhere in your app:
$session = \App::make('CodeZero\Session\Session');
TIP: Laravel's IoC container will automatically provide the Laravel specific
Session
implementation. This will use Laravel'sSession
goodness behind the scenes!
$session->store('key', 'value');
$session->store('key', ['array' => 'value']);
If a key doesn't exist, null
will be returned.
$array = $session->get(); // An array of all data
$value = $session->get('key'); // Specific data
$session->flush(); // Clear all data
$session->delete('key'); // Clear specific data
This will flush all data and regenerate the session ID.
$session->destroy();
$ vendor/bin/phpspec run
If you discover any security related issues, please e-mail me instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.