Download the PHP package pascalkrieger/laravel-cookie-consent without Composer
On this page you can find all versions of the php package pascalkrieger/laravel-cookie-consent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pascalkrieger/laravel-cookie-consent
More information about pascalkrieger/laravel-cookie-consent
Files in pascalkrieger/laravel-cookie-consent
Package laravel-cookie-consent
Short Description Allow/disallow types of cookies in your Laravel Application
License MIT
Informations about the package laravel-cookie-consent
Laravel Cookie Consent
This package currently work in progress.
The package provides the views and controllers necessary to display a fixed message at the bottom of the window, prompting the user to accept the cookies or configure them.
If the user chooses to configure the cookies a modal will be displayed listing all types of cookies the website uses, allowing to disable or enable certain types. Once his preferences are saved a button is displayed enabling the user to configure his preferences.
The views are styled with tailwindcss and alpinejs leverages the rest, so these are prerequisite in your Laravel project.
Once the preferences are saved, you can check in your views if a certain type of cookies is allowed like this:
Where Functional
corresponds to one of the type
values in the cookies array of your config file.
Installation
This package is intended for use in existing Laravel projects using Tailwindcss and AlpineJS.
You can install the package via composer:
Tailwindcss and AlpineJS should be installed, if not install them following the instructions in their documentation.
For Tailwindcss visit: https://tailwindcss.com/docs/guides/laravel
For AlpineJS visit: https://alpinejs.dev/essentials/installation
Publish the views running:
Then run:
Usage
Include the blade component at the bottom of your page or layout:
You should publish and edit the config file, run this command:
The code is pretty basic and self explanatory. As stated before this is work in progress, in use right now in some of my other projects. You´re welcome to use it as you wish.
Localization
The package currently ships with translations for English and Spanish. you can easily add more languages, first publish the packages lang folder with:
Add a folder to lang/vendor/laravel-cookie-consent
with your language code, for example lang/vendor/laravel-cookie-consent/de
, and place a text.php
file with the following contents within it: