Skip to content

Latest commit

 

History

History
75 lines (53 loc) · 2.19 KB

README.rst

File metadata and controls

75 lines (53 loc) · 2.19 KB

CookiesBundle

Cookies bundle provides Symfony way to handle cookies defining them as services.

https://travis-ci.org/ongr-io/CookiesBundle.svg?branch=master https://scrutinizer-ci.com/g/ongr-io/CookiesBundle/badges/quality-score.png?b=master https://scrutinizer-ci.com/g/ongr-io/CookiesBundle/badges/coverage.png?b=master

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

Documentation for this bundle can be found here

License

This bundle is under the MIT license. Please, see the complete license in the bundle LICENSE file.