Download the PHP package radosavleovac/laravel-consent-mode without Composer
On this page you can find all versions of the php package radosavleovac/laravel-consent-mode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download radosavleovac/laravel-consent-mode
More information about radosavleovac/laravel-consent-mode
Files in radosavleovac/laravel-consent-mode
Package laravel-consent-mode
Short Description GDPR Compliant Google Consent Mode V2 for Laravel
License MIT
Informations about the package laravel-consent-mode
Laravel Consent Mode
GDPR Compliant Google Consent Mode V2 for Laravel
This package provides an easy way to implement Google Consent Mode V2 in Laravel applications while complying with GDPR regulations. It supports TailwindCSS for styling and offers customizable cookie consent management.
🚀 Features
✅ Google Consent Mode V2 compliant ✅ Supports TailwindCSS for styling ✅ Easy integration with Laravel ✅ Customizable cookie categories ✅ Consent-based loading of Google Tag Manager (GTM) ✅ Multi-language support ✅ Publishable assets (JS, CSS, Views, and Config)
📌 Installation
1️⃣ Install the package via Composer
Run the following command in your Laravel project:
2️⃣ Publish the configuration file
After installation, publish the configuration file using:
This will create a configuration file at:
3️⃣ Publish assets (JS & CSS)
To publish the required JavaScript and CSS files, run:
This will place the assets in the public/js and public/css folders.
4️⃣ Publish translations (optional)
To publish language files for customization:
5️⃣ Publish views (optional)
If you want to override the default views:
This will copy the views to:
📖 Configuration
Edit the config/consent.php file to configure the cookie categories and default settings:
🚀 Usage
1️⃣ Add the consent banner
Include the following Blade directive in your main layout, near or in footer (e.g., resources/views/layouts/app.blade.php):
2️⃣ Add the Google Tag after head opening
2️⃣ Add the noscript Tag after body opening
🎯 Example: Handling Consent in JavaScript
When the user accepts all cookies, the following function is executed:
🔧 Customization
- Edit views in
resources/views/vendor/cookie-consent/ - Modify translations in
resources/lang/vendor/cookie-consent/ - Adjust CSS styles in
public/css/cookie.css
To enable visitors to change settings you can place a button in your code
To display map after user gave permission you can use
📄 License
This package is licensed under the MIT licence.
To do - tutorial how to setup Google Tag manager