uam/cookie-consent-bundle

Add a banner allowing the user to consent to your symfony app's cookie policy

1.0.6 2017-04-26 12:55 UTC

This package is auto-updated.

Last update: 2024-10-29 04:04:10 UTC


README

A symfony 2 bundale that provides a convenient way to allow the user to consent to your symfony app's cookie policy.

Installation

Add the bundle to your project's composer.json:

{
    "require": {
        "uam/cookie-consent-bundle": "^1.0",
        ...
    }
}

Run composer install or composer update to install the bundle:

$ php composer.phar update

Enable the bundle in the app's kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new UAM\CookieConsent\CookieConsentBundle\UAMCookieConsentBundle(),
    );
}

If your composer.json does not include the post-install or post-update installAssets script handler, then run the following command:

$ php app/console assets:install

or

$ php app/console assets:install --symlink

Usage

# base.html.twig

{% stylesheets filter="cssrewrite"
    'bundles/uamcookieconsent/css/cookie-consent.css'
%}
	<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}

{% javascripts
	'bundles/uamcookieconsent/js/cookie-consent.js'
%}
	<script src="{{ asset_url }}"></script>
{% endjavascripts %}

If you use assetic, you need to declare the UAMCookieConsentBundle in your config file's assetic section.

# base.html.twig

{% stylesheets filter="cssrewrite"
    '@uam_cookie_consent_css'
%}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}

{% javascripts
    '@uam_cookie_consent_js'
%}
    <script src="{{ asset_url }}"></script>
{% endjavascripts %}

Licence

This bundle is licensed under the MIT license.

The dataTables jquery plugin is licensed under the MIT license.

Copyright

This bundle is copyright United Asian Management Limited.

The dataTables jquery plugin is copyright Allan Jardine (www.sprymedia.co.uk).

All rights reserved by their respective copyright holders.