Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/websoftwares/session
PHP 5.3+ Session Class that accepts optional save handlers.
https://github.com/websoftwares/session
Last synced: 29 days ago
JSON representation
PHP 5.3+ Session Class that accepts optional save handlers.
- Host: GitHub
- URL: https://github.com/websoftwares/session
- Owner: websoftwares
- Created: 2013-08-22T13:10:10.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-26T07:38:17.000Z (over 11 years ago)
- Last Synced: 2024-10-12T13:18:45.068Z (3 months ago)
- Language: PHP
- Size: 141 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Session
PHP 5.3+ Session Class that accepts optional save handlers.[![Build Status](https://api.travis-ci.org/websoftwares/Session.png)](https://travis-ci.org/websoftwares/Session)
## Installing via Composer (recommended)
Install composer in your project:
```
curl -s http://getcomposer.org/installer | php
```Create a composer.json file in your project root:
```
{
"require": {
"websoftwares/session": "dev-master"
}
}
```
Install via composer
```
php composer.phar install
```## Usage
Basic usage of the `Session` class.```php
use Websoftwares\Session;// Instantiate class
$session = new Session;// Start session
$session->start();// Store in session
$session["key"] = 'value';var_dump($_SESSION);
// Destroy
$session->destroy();
```
## Options
U can override the default options by instantiating a `Session` class and pass in an _array_ as the second argument.```php
$options = array(
// If enabled (default) extra meta data is added (name,created,updated)
'meta' => true,
// Provide custom session name
'name' => null,
'lifetime' => 0,
'path' => '/',
'domain' => null,
'secure' => true,
'httponly' => false
);// Instantiate class
$session = new Session(null,$options);```
## start();
Start a new session.
```php
$session->start();
```## destroy();
Destory the session.
```php
$session->destroy();
```## close();
Close the session.
```php
$session->close();
```## active();
Find out if their is a session active.
```php
$session->active();
```## id($string);
Set session id, Get current/previous session id.
```php
$session->id($string);
```## regenerate();
Regenerate session id, optional bool true for session deletion.
```php
$session->regenerate();
```## ArryAccess
U can access the session object as an array.
```php
$session["key"] = "value";
```## Testing
In the tests folder u can find several tests.## License
[DBAD](http://www.dbad-license.org/ "DBAD") Public License.## Acknowledgement
All the great session managment solutions.