Brain’s Cookie’s class is a static class. All it does is facilitate super easy cookie management, but allows you to save anything that can be serialized, and it automatically encrypts/decrypts on the fly.
Usage
// Set a cookie named "awesome" $arr = [ 'red', 'yellow', 'blue' ]; Cookie::set( 'awesome', $arr ); // Get the contents of the cookie named "awesome". $contents = Cookie::get('awesome'); // Kill the "awesome" cookie Cookie::destroy('awesome');
Note about set()
The set method has a third parameter. By default the cookie is a persistent cookie. If you want it expire on browser close, you can provide a zero, 0. If you want it to expire at X seconds in the future, just provide the number of seconds.