Skip to content

renegare/silexcsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SilexCSH

Silex Cookie Session Handler

Build Status Coverage Status

Requirements

Installation

$ composer require renegare/silexcsh:dev-master

Usage Examples:

Silex Usage

<?php

$app = new Silex\Application();

$app->register(new Renegare\SilexCSH\CookieSessionServiceProvider, [
    'session.cookie.options' => [
        'name' => 'CUSTOMNAME', // string
        'lifetime' => 0,        // int
        'path' => '/',          // string
        'domain' => null,       // string
        'secure' => false,      // boolean
        'httponly' => true      // boolean
    ]
]);

$app->get('/doing-nothing', function(Application $app) {
    return 'Nothing going on here with sessions';
});

$app->get('/persist', function(Application $app){
    $app['session']->set('message', 'Hello There!');
    return 'Check your cookie!';
});

$app->get('/read', function(Application $app){
    return print_r($app['session']->all(), true);
});

$app->get('/destroy', function(Application $app) {
    $app['session']->clear();
    return 'Ok Bye Bye!';
});

Test

Check out the repo and from the top level directory run the following command (xdebug required for coverage):

$ composer update && vendor/bin/phpunit --coverage-text

Credits

Inspired by: nelmio/NelmioSecurityBundle

About

Silex Cookie Session Handler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages