locosoftworks / php-cookie-session
Session save handler used to store the session in a cookie
Installs: 24
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/locosoftworks/php-cookie-session
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2025-10-25 22:09:17 UTC
README
Requires
- PHP >= 5.3
Composer Install
"minimum-stability": "dev",
"require": {
    "locosoftworks/php-cookie-session": "dev-master"
}
Usage
$handler = new Loco\Session\SaveHandler\ClientSession();
It is recommended that you encrypt the session.  Create a class that implements Loco\Crypt\CipherInterface and inject it into the session handler
$handler->setCipher($myEncryptionClass);
Set the session save handler using session_set_save_handler() (see php documentation)
session_set_save_handler(
    array($handler, 'open'),
    array($handler, 'close'),
    array($handler, 'read'),
    array($handler, 'write'),
    array($handler, 'destroy'),
    array($handler, 'gc')
);
session_start();
You MUST call session_write_close BEFORE returning any output.  Output Buffering is recommended.