An open API service indexing awesome lists of open source software.

https://github.com/fatkulnurk/session

PHP library for handling sessions
https://github.com/fatkulnurk/session

php php-composer php-library session session-management session-manager

Last synced: 5 months ago
JSON representation

PHP library for handling sessions

Awesome Lists containing this project

README

          

# PHP SESSION
---
PHP library for handling sessions

### Install
See in packagist
````
https://packagist.org/packages/fatkulnurk/session
````
with composer
```
composer require fatkulnurk/session
```

### Under Development
- [ ] Get session with nested key
- [ ] Set session with Nested Value

### Usage

**Start session:**
```
Session::init();
```

**Start session by setting the session duration:**

Param in seconds.
```
Session::init(3600);
```

**Add value to a session:**
```
Session::set('name', 'Fatkul Nur Koirudin');
```

**Add multiple value to sessions:**

Unsupport for nested array.
```
$data = [
'name' => 'Rudi',
'gender' => 'Male',
];

Session::set($data);
```

**Extract session item, delete session item and finally return the item:**
```
Session::pull('name');
```

**Return the session array / Return all session value:**
```
Session::get();
```

**Get session id:**
```
Session::id();
```

**Destroys one key session:**
```
Session::destroy('name');
```

**Destroys all sessions:**
```
Session::destroy();
```