Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geggleto/geggleto-session
Object oriented wrapper around the super global _SESSION
https://github.com/geggleto/geggleto-session
Last synced: 5 days ago
JSON representation
Object oriented wrapper around the super global _SESSION
- Host: GitHub
- URL: https://github.com/geggleto/geggleto-session
- Owner: geggleto
- License: mit
- Created: 2016-01-26T16:03:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-21T15:47:55.000Z (over 8 years ago)
- Last Synced: 2024-04-17T06:01:00.411Z (7 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# geggleto-session
Object oriented wrapper around the super global _SESSION# Usage
```php
//Make sure you are starting the session somewhere... session_start()$sessionContainer = new Session();
$session->flash("error", "My error");
//In your view on the next page
$session->getFlash("error");
```# Helpers
If you are using Twig it might be helpful to just directly inject the error.```php
//Inject Error's into twig
/** @var $session \Geggleto\Session */
$session = $c[Geggleto\Session::class]; // Grab from the container
$error = $session->getFlash("error"); //Grab the messageif (isset($error)) {
$view->getEnvironment()->addGlobal("error", $error); //Inject it into twig as a global
}
```