https://github.com/userfrosting/session
Wrapper for $_SESSION that can be used with a variety of different session handlers, based on illuminate/session
https://github.com/userfrosting/session
userfrosting userfrosting-component
Last synced: 5 months ago
JSON representation
Wrapper for $_SESSION that can be used with a variety of different session handlers, based on illuminate/session
- Host: GitHub
- URL: https://github.com/userfrosting/session
- Owner: userfrosting
- License: other
- Archived: true
- Created: 2016-06-02T22:16:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T00:02:36.000Z (about 5 years ago)
- Last Synced: 2025-09-30T20:55:38.974Z (9 months ago)
- Topics: userfrosting, userfrosting-component
- Language: PHP
- Homepage:
- Size: 54.7 KB
- Stars: 2
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Sessions module for UserFrosting 4
[](https://github.com/userfrosting/session/releases)
[](LICENSE.md)
[](https://chat.userfrosting.com/channel/support)
[](https://opencollective.com/userfrosting#backer)
| Branch | Build | Coverage | Style |
| ------ |:-----:|:--------:|:-----:|
| [master][Session] | [![][session-master-build]][session-travis] | [![][session-master-codecov]][session-codecov] | [![][session-style-master]][session-style] |
| [develop][session-develop] | [![][session-develop-build]][session-travis] | [![][session-develop-codecov]][session-codecov] | [![][session-style-develop]][session-style] |
[Session]: https://github.com/userfrosting/session
[session-develop]: https://github.com/userfrosting/session/tree/develop
[session-version]: https://img.shields.io/github/release/userfrosting/session.svg
[session-master-build]: https://github.com/userfrosting/session/workflows/Build/badge.svg?branch=master
[session-master-codecov]: https://codecov.io/gh/userfrosting/session/branch/master/graph/badge.svg
[session-develop-build]: https://github.com/userfrosting/session/workflows/Build/badge.svg?branch=develop
[session-develop-codecov]: https://codecov.io/gh/userfrosting/session/branch/develop/graph/badge.svg
[session-releases]: https://github.com/userfrosting/session/releases
[session-travis]: https://github.com/userfrosting/session/actions?query=workflow%3ABuild
[session-codecov]: https://codecov.io/gh/userfrosting/session
[session-style-master]: https://github.styleci.io/repos/60301008/shield?branch=master&style=flat
[session-style-develop]: https://github.styleci.io/repos/60301008/shield?branch=develop&style=flat
[session-style]: https://github.styleci.io/repos/60301008
## Example usage:
```
use Illuminate\Filesystem\Filesystem;
use Illuminate\Session\FileSessionHandler;
use UserFrosting\Session\Session;
// Use custom filesystem sessions
$fs = new FileSystem;
$handler = new FileSessionHandler($fs, \UserFrosting\APP_DIR . "/sessions");
// Creates a new wrapper for $_SESSION
$session = new Session($handler, $config['session']);
// Starts the session
$session->start();
// Set some values
$session['contacts.housekeeper.name']; = 'Alex "the man" Weissman';
// They're stored in array format...
print_r($session->all());
// Output is:
/*
[
'contacts' => [
'housekeeper' => [
'name' => 'Alex "the man" Weissman'
]
]
];
*/
// Destroy the session, both in memory and on the persistence layer, and tell the browser to remove the cookie
$session->destroy();
```
## [Style Guide](STYLE-GUIDE.md)
## [Testing](RUNNING_TESTS.md)