This is an example of using laravel 4.1 CookieGuard middleware with silex. This demonstrates the composability of stack middlewares.
All of the outgoing cookies are encrypted. If decryption of incoming cookies fails, the application will ignore them.
Just clone the gist and install the dependencies via composer.
$ composer install
You can use the PHP built-in webserver to run the example. Just type this into the console:
$ php -S localhost:8080 example.php
Then open http://localhost:8080
in your browser.