/statamic-cookie-consent

A Statamic cookie consent wrapper for the Spatie package 'laravel-cookie-consent'

Primary LanguagePHPMIT LicenseMIT

Statamic Cookie Consent

Statamic 3.0+ Latest Version on Packagist

This Package is basically a wrapper for the Laravel Cookie Consent Package from Spatie.

Installation

Pull in your package with composer

composer require jonassiewertsen/statamic-cookie-consent

Styling

Remember to write some nice CSS to style the consent banner.

Those are the default classes

<div class="js-cookie-consent cookie-consent">
    <span class="cookie-consent__message">
        Your experience on this site will be improved by allowing cookies.
    </span>
    <button class="js-cookie-consent-agree cookie-consent__agree">
        Allow cookies
    </button>
</div>

Settings

Disabling the cookie consent

You can disable the package in your .env file

COOKIE_CONSENT_ENABLED=false

Publishing the lang files

php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="lang"

Publishing the view

php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="views"

Publishing the config file

php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="config"

License

This Package / Addon is open source. Feel free to contribute or use it however you like!