Download the PHP package ideacatlab/laravel-cookie-consent-enhanced without Composer
On this page you can find all versions of the php package ideacatlab/laravel-cookie-consent-enhanced. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ideacatlab/laravel-cookie-consent-enhanced
More information about ideacatlab/laravel-cookie-consent-enhanced
Files in ideacatlab/laravel-cookie-consent-enhanced
Package laravel-cookie-consent-enhanced
Short Description Make your Laravel app comply with the EU cookie law and implement a cookie control system that allows users to manage their own cookie preferences
License MIT
Homepage https://github.com/ideacatlab/laravel-cookie-consent-enhanced
Informations about the package laravel-cookie-consent-enhanced
Elevate Your Laravel App's GDPR Compliance with Enhanced Cookie Consent
Ensuring compliance with EU laws on cookie usage is crucial for websites targeting or owned by EU citizens. Dive into the capabilities of this Laravel package, a robust extension originating from Spatie's Laravel Cookie Consent. Developed by IdeaCat, a web development agency in Bucharest, Romania, this package not only simplifies the implementation of a cookie consent dialog but also extends its functionalities. Beyond the essentials, it introduces advanced features like predefined database tables, administrative tools for user data management, and seamless integration of GDPR compliance requirements.
Explore further details about the EU legislation on cookies here.
Installation and Configuration
1. Install the Package
You can effortlessly install the package via Composer. Open your terminal and run:
The package will automatically register itself in your Laravel application.
2. Publish Vendor Files
Run the publish command to publish the views, languages, database migration, config and assets.
3. Migrate the Database
Execute the migration command to create the required database tables:
Configuration Details
Upon publishing the configuration file, you'll find a file named cookie-consent-enhanced.php
in the config
directory. Here's an overview of the configuration options:
Note on Cookie Domain
Ensure you set the cookie domain by using the 'domain' key in the config/session.php
file. Add the corresponding value in your .env
file for SESSION_DOMAIN
. If your URL includes a port, such as 'localhost:3000', it is crucial to set this value for the package to function correctly.
Usage and Customization
Displaying the Cookie Consent Dialog Using Blade Template
To effortlessly display the cookie consent dialog in your template, include the following line in your Blade file:
This will render a dialog similar to the one depicted below. Note that the default styling, powered by TailwindCSS v2, creates a floating banner at the bottom of the page.
Displaying the Cookie Consent Dialog Using the Middleware
Instead of manually including cookie-consent-enhanced::index
in your view, consider adding the middleware to your kernel:
This will automatically add cookie-consent-enhanced::index
to your response just before the closing body tag.
Upon clicking "Allow cookies," a cookie_consent
cookie will be set, and the dialog will be removed from the DOM. Laravel, recognizing the set laravel_cookie_consent
cookie on subsequent requests, will refrain from displaying the dialog again.
Customizing Dialog Texts
The files is published to resources/lang/vendor/cookie-consent-enhanced/en/texts.php
. You can then customize the text as follows:
For translations, copy the file to, for instance, resources/lang/vendor/cookie-consent-enhanced/fr/texts.php
and provide the French translations.
Customizing Dialog Contents
The files is published to the index
and dialogContents
view files to resources/views/vendor/cookie-consent-enhanced
. Typically, you only need to modify the dialogContents
view. Adjusting the JavaScript code is possible in the index
view file.
Testing
Execute the following command to run tests:
Security
If you discover any security-related issues, please contact [email protected] instead of using the issue tracker.
License
This project is licensed under the MIT License. See License File for more information.
All versions of laravel-cookie-consent-enhanced with dependencies
illuminate/support Version ^10.23.1
illuminate/view Version ^10.23.1
illuminate/cookie Version ^10.23.1
spatie/laravel-package-tools Version ^1.16.1