Skip to content

Cookie models for using cookies as Symfony services

License

Notifications You must be signed in to change notification settings

lmikelionis/CookiesBundle

 
 

Repository files navigation

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.

About

Cookie models for using cookies as Symfony services

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%