Cookies bundle provides Symfony way to handle cookies defining them as services.
Usage example in code:
class CookieController
{
public function readAction()
{
$cart = $this->container->get('project.cookie.cart')->getValue();
$items = $cartCookie['items'];
// ...
}
}
Cookie configuration example:
parameters:
# One can optionally override defaults.
project.cookie.cart.defaults:
http_only: false
expires_interval: P5DT4H # 5 days and 4 hours
services:
project.cookie.cart:
class: %ongr_cookie.json.class%
arguments: [ "project_cart" ]
calls:
- [ setDefaults, [ %project.cookie_foo.defaults% ] ]
tags:
- { name: ongr_cookie.cookie }
Documentation for this bundle can be found here
This bundle is under the MIT license. Please, see the complete license in the bundle LICENSE file.