{"id":27217407,"url":"https://github.com/devrabiul/laravel-cookie-consent","last_synced_at":"2026-02-28T19:00:48.084Z","repository":{"id":285085371,"uuid":"956801137","full_name":"devrabiul/laravel-cookie-consent","owner":"devrabiul","description":"A GDPR-compliant solution offering enterprise-grade compliance with fully customizable cookie banners for Laravel applications.","archived":false,"fork":false,"pushed_at":"2026-01-14T20:54:35.000Z","size":647,"stargazers_count":136,"open_issues_count":1,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-15T00:55:27.879Z","etag":null,"topics":["cookie-consent","gdpr","gdpr-cookie","laravel","laravel-cookie-consent","php"],"latest_commit_sha":null,"homepage":"https://packages.rixetbd.com/devrabiul/laravel-cookie-consent","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devrabiul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-28T22:13:40.000Z","updated_at":"2026-01-14T20:54:44.000Z","dependencies_parsed_at":"2025-04-10T05:33:31.342Z","dependency_job_id":"ee52dcae-7b3b-4264-86ab-4124ae51bb53","html_url":"https://github.com/devrabiul/laravel-cookie-consent","commit_stats":null,"previous_names":["devrabiul/laravel-cookie-consent"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/devrabiul/laravel-cookie-consent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrabiul%2Flaravel-cookie-consent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrabiul%2Flaravel-cookie-consent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrabiul%2Flaravel-cookie-consent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrabiul%2Flaravel-cookie-consent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devrabiul","download_url":"https://codeload.github.com/devrabiul/laravel-cookie-consent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrabiul%2Flaravel-cookie-consent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29948228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookie-consent","gdpr","gdpr-cookie","laravel","laravel-cookie-consent","php"],"created_at":"2025-04-10T05:28:29.673Z","updated_at":"2026-02-28T19:00:48.065Z","avatar_url":"https://github.com/devrabiul.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Cookie Consent\n\nA GDPR-compliant solution offering enterprise-grade compliance with fully customizable cookie banners for Laravel\napplications. Simplifies regulatory requirements while maintaining excellent user experience and complete customization\ncapabilities.\n\n[![Latest Stable Version](https://poser.pugx.org/devrabiul/laravel-cookie-consent/v/stable)](https://packagist.org/packages/devrabiul/laravel-cookie-consent)\n[![Total Downloads](https://poser.pugx.org/devrabiul/laravel-cookie-consent/downloads)](https://packagist.org/packages/devrabiul/laravel-cookie-consent)\n[![Monthly Downloads](https://poser.pugx.org/devrabiul/laravel-cookie-consent/d/monthly)](https://packagist.org/packages/devrabiul/laravel-cookie-consent)\n![GitHub license](https://img.shields.io/github/license/devrabiul/laravel-cookie-consent)\n[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/devrabiul/laravel-cookie-consent)\n![GitHub Repo stars](https://img.shields.io/github/stars/devrabiul/laravel-cookie-consent?style=social)\n\n## Features\n\n- 🔥 **One-Click Implementation** – Simple installation via Composer with auto-loaded assets\n- ⚡ **Zero Performance Impact** – Lightweight with lazy-loaded components\n- 🌍 **RTL \u0026 i18n Support** – Full right-to-left compatibility + multilingual translations\n- 🌙 **Dark Mode Support** – Auto dark/light mode matching system preferences\n- 🛡 **Granular Consent Control** – Category-level cookie management (necessary/analytics/marketing)\n- 📦 **Complete Customization** – Override every color, text, and layout via config\n- 📱 **Responsive Design** – Perfectly adapts to all devices (mobile/tablet/desktop)\n- 🧩 **No Frontend Dependencies** – No jQuery, Bootstrap, or Tailwind required — works everywhere effortlessly\n\n---\n\n## 🚀 Live Demo\n\n👉 [Try the Live Demo](https://rixetbd.com/docs?package=laravel-cookie-consent)\n\n![Live Demo Thumbnail](https://rixetbd.com/storage/app/public/package/devrabiul/laravel-cookie-consent.webp)\n\n---\n\n## Installation\n\nTo get started with Cookie Consent, follow these simple steps:\n\n1. Install the package via Composer:\n\n```bash\ncomposer require devrabiul/laravel-cookie-consent\n```\n\n2. Publish the package resources by running: (Normal publish)\n\n```bash\nphp artisan vendor:publish --provider=\"Devrabiul\\CookieConsent\\CookieConsentServiceProvider\"\n```\n\n## Basic Usage\n\nInclude these components in your Blade templates:\n\n1. Add styles in the `\u003chead\u003e` section:\n\n```php\n{!! CookieConsent::styles() !!}\n```\n\n2. Add scripts before closing `\u003c/body\u003e`:\n\n```php\n{!! CookieConsent::scripts() !!}\n```\n\n### Complete Example\n\n```php\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eYour Page\u003c/title\u003e\n    {!! CookieConsent::styles() !!}\n\u003c/head\u003e\n\u003cbody\u003e\n\n    \u003c!-- Your content --\u003e\n    {!! CookieConsent::scripts() !!}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Advanced Configuration\n\n```php\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003eYour Page\u003c/title\u003e\n    {!! CookieConsent::styles() !!}\n\u003c/head\u003e\n\u003cbody\u003e\n\n    \u003c!-- Your content --\u003e\n    {!! CookieConsent::scripts(options: [\n        'cookie_lifetime' =\u003e config('laravel-cookie-consent.cookie_lifetime', 7),\n        'reject_lifetime' =\u003e config('laravel-cookie-consent.reject_lifetime', 1),\n        'disable_page_interaction' =\u003e config('laravel-cookie-consent.disable_page_interaction', true),\n        'preferences_modal_enabled' =\u003e config('laravel-cookie-consent.preferences_modal_enabled', true),\n        'consent_modal_layout' =\u003e config('laravel-cookie-consent.consent_modal_layout', 'bar-inline'),\n        'flip_button' =\u003e config('laravel-cookie-consent.flip_button', true),\n        'theme' =\u003e config('laravel-cookie-consent.theme', 'default'),\n        'cookie_prefix' =\u003e config('laravel-cookie-consent.cookie_prefix', 'Laravel_App'),\n        'policy_links' =\u003e config('laravel-cookie-consent.policy_links', [\n            ['text' =\u003e CookieConsent::translate('Privacy Policy'), 'link' =\u003e url('privacy-policy')],\n            ['text' =\u003e CookieConsent::translate('Terms \u0026 Conditions'), 'link' =\u003e url('terms-and-conditions')],\n        ]),\n        'cookie_categories' =\u003e config('laravel-cookie-consent.cookie_categories', [\n            'necessary' =\u003e [\n                'enabled' =\u003e true,\n                'locked' =\u003e true,\n                'js_action' =\u003e 'loadGoogleAnalytics',\n                'title' =\u003e CookieConsent::translate('Essential Cookies'),\n                'description' =\u003e CookieConsent::translate('These cookies are essential for the website to function properly.'),\n            ],\n            'analytics' =\u003e [\n                'enabled' =\u003e env('COOKIE_CONSENT_ANALYTICS', false),\n                'locked' =\u003e false,\n                'title' =\u003e CookieConsent::translate('Analytics Cookies'),\n                'description' =\u003e CookieConsent::translate('These cookies help us understand how visitors interact with our website.'),\n            ],\n            'marketing' =\u003e [\n                'enabled' =\u003e env('COOKIE_CONSENT_MARKETING', false),\n                'locked' =\u003e false,\n                'js_action' =\u003e 'loadFacebookPixel',\n                'title' =\u003e CookieConsent::translate('Marketing Cookies'),\n                'description' =\u003e CookieConsent::translate('These cookies are used for advertising and tracking purposes.'),\n            ],\n            'preferences' =\u003e [\n                'enabled' =\u003e env('COOKIE_CONSENT_PREFERENCES', false),\n                'locked' =\u003e false,\n                'js_action' =\u003e 'loadPreferencesFunc',\n                'title' =\u003e CookieConsent::translate('Preferences Cookies'),\n                'description' =\u003e CookieConsent::translate('These cookies allow the website to remember user preferences.'),\n            ],\n        ]),\n        'cookie_title' =\u003e CookieConsent::translate('Cookie Disclaimer'),\n        'cookie_description' =\u003e CookieConsent::translate('This website uses cookies to enhance your browsing experience, analyze site traffic, and personalize content. By continuing to use this site, you consent to our use of cookies.'),\n        'cookie_modal_title' =\u003e CookieConsent::translate('Cookie Preferences'),\n        'cookie_modal_intro' =\u003e CookieConsent::translate('You can customize your cookie preferences below.'),\n        'cookie_accept_btn_text' =\u003e CookieConsent::translate('Accept All'),\n        'cookie_reject_btn_text' =\u003e CookieConsent::translate('Reject All'),\n        'cookie_preferences_btn_text' =\u003e CookieConsent::translate('Manage Preferences'),\n        'cookie_preferences_save_text' =\u003e CookieConsent::translate('Save Preferences'),\n    ]) !!}\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 🌙 Enable Dark Mode\n\nAdd `theme=\"dark\"` to your `\u003cbody\u003e` tag to automatically enable dark mode.\n\n```html\n\u003cbody theme=\"dark\"\u003e\u003c/body\u003e\n```\n\n---\n\n## Theme Preset Support\n\nThis package now supports **preset color themes** for cookie banners. You can choose from:\n\n| Preset         | Description                                                    |\n| -------------- | -------------------------------------------------------------- |\n| `basic`        | Default neutral theme, clean and simple.                       |\n| `modern-blue`  | Professional blue style, ideal for SaaS/web apps.              |\n| `trust-green`  | Privacy-friendly green, promotes trust and eco-friendly vibes. |\n| `soft-neutral` | Minimal soft gray, subtle and non-intrusive.                   |\n| `dark`         | Dark mode theme, low-light friendly.                           |\n\n### How to configure\n\nIn `config/cookie-consent.php`:\n\n```php\n/*\n|--------------------------------------------------------------------------\n| Theme Preset\n|--------------------------------------------------------------------------\n| basic        - Default neutral theme\n| modern-blue  - Professional blue style\n| trust-green  - Privacy-friendly green style\n| soft-neutral - Minimal soft gray theme\n| dark         - Dark theme\n*/\n'theme_preset' =\u003e env('COOKIE_CONSENT_THEME_PRESET', 'basic'),\n```\n\n---\n\n### 🌐 Enable RTL Mode\n\nAdd `dir=\"rtl\"` to your `\u003cbody\u003e` tag to enable right-to-left layout for RTL languages.\n\n```html\n\u003cbody dir=\"rtl\"\u003e\u003c/body\u003e\n```\n\n## Layout Options\n\n### Config Status Control\n\n```bash\nCOOKIE_CONSENT_ENABLED=true\nCOOKIE_CONSENT_PREFERENCES_ENABLED=true\nCOOKIE_CONSENT_ASSET_URL=https://your-domain.com // if you are in localhost, avoid this or put null\n\nCOOKIE_CONSENT_ANALYTICS=true\nCOOKIE_CONSENT_MARKETING=true\nCOOKIE_CONSENT_PREFERENCES=true\n```\n\n### Consent Modal Styles\n\n- **`box`** - Compact floating dialog\n- **`box-inline`** - Inline positioned box\n- **`box-wide`** - Expanded floating dialog\n- **`cloud`** - Modern floating design\n- **`cloud-inline`** - Compact cloud variant\n- **`bar`** - Top/bottom banner\n- **`bar-inline`** - Compact banner\n\n*Default: `box-wide`*\n\n### Preferences Modal Styles\n\n- **`bar`** - Full-width layout\n- **`box`** - Centered popup\n\n*Default: `bar`*\n\n## Configuration\n\nEdit `config/cookie-consent.php` to modify:\n\n- Cookie lifetimes\n- Custom asset URL\n- Visual styles\n- Text content\n- Category settings\n\n### Example service loader (replace with your actual implementation)\n\n```javascript\nfunction loadGoogleAnalytics() {\n    // Please put your GA script in loadGoogleAnalytics()\n    // You can define function name from - {!! CookieConsent::scripts() !!}\n\n    window.dataLayer = window.dataLayer || [];\n\n    function gtag() {\n        dataLayer.push(arguments);\n    }\n\n    gtag('js', new Date());\n    gtag('config', 'YOUR_GA_ID');\n\n    // Load the GA script\n    const script = document.createElement('script');\n    script.src = 'https://www.googletagmanager.com/gtag/js?id=YOUR_GA_ID';\n    script.async = true;\n    document.head.appendChild(script);\n}\n\nfunction loadFacebookPixel() {\n    // Please put your marketing script in loadFacebookPixel()\n    // You can define function name from - {!! CookieConsent::scripts() !!}\n\n    !function (f, b, e, v, n, t, s) {\n        if (f.fbq) return;\n        n = f.fbq = function () {\n            n.callMethod ?\n                n.callMethod.apply(n, arguments) : n.queue.push(arguments)\n        };\n        if (!f._fbq) f._fbq = n;\n        n.push = n;\n        n.loaded = !0;\n        n.version = '2.0';\n        n.queue = [];\n        t = b.createElement(e);\n        t.async = !0;\n        t.src = v;\n        s = b.getElementsByTagName(e)[0];\n        s.parentNode.insertBefore(t, s)\n    }(window, document, 'script',\n        'https://connect.facebook.net/en_US/fbevents.js');\n    fbq('init', 'YOUR_PIXEL_ID');\n    fbq('track', 'PageView');\n}\n```\n\n---\n\n## Change Cookie Preferences Link\n\nTo comply with UK ICO and GDPR regulations, users **must be able to revisit and update their cookie preferences at any time**. This package now supports that functionality out of the box.\n\nYou can add a link anywhere on your site to let users open the cookie preferences modal again and update their choices:\n\n```html\n\u003ca onclick=\"showHideToggleCookiePreferencesModal()\"\u003eChange Cookie Preferences\u003c/a\u003e\n```\n\nOr use the class-based approach (useful if you want to attach event handlers via JavaScript or multiple links):\n\n```html\n\u003ca class=\"showHideToggleCookiePreferencesModal\"\u003eChange Cookie Preferences\u003c/a\u003e\n```\n\n### How It Works\n\n* Clicking the link will **show the cookie preferences modal**, allowing the user to change their settings.\n* This feature **resets the consent banner/modal visibility** so users can modify their choices in compliance with the ICO’s requirement.\n* The modal respects existing preferences but allows full customization and saving new preferences.\n\n---\n\n## Compliance with UK ICO and GDPR\n\nThis package is designed to help your Laravel application meet the requirements of the UK Information Commissioner’s Office (ICO) and the GDPR by:\n\n* **Providing explicit, granular cookie consent** with customizable categories (e.g., necessary, analytics, marketing, preferences).\n* **Allowing users to easily revisit and change their cookie preferences** at any time using the “Change Cookie Preferences” link.\n* Supporting **clear cookie banners and modals** with translations and accessibility considerations.\n* Enabling **consent logging and event dispatching** for auditing and analytics purposes.\n\nFor more details, please review the UK ICO guidance on cookies:\n[ICO Guide to Cookies and Similar Technologies](https://ico.org.uk/for-organisations/guide-to-pecr/cookies-and-similar-technologies/)\n\n---\n\n### 🎯 Get Started Today!\n\nExperience the magic of CookieConsent and enhance your Laravel applications with Cookie Consent.\n\n🔗 **GitHub:** [Laravel Cookie Consent](https://github.com/devrabiul/laravel-cookie-consent)  \n🔗 **Packagist:\n** [https://packagist.org/packages/devrabiul/laravel-cookie-consent](https://packagist.org/packages/devrabiul/laravel-cookie-consent)\n\n## Contributing\n\nWe welcome contributions to CookieConsent! If you would like to contribute, please fork the repository and submit a pull\nrequest. For any issues or feature requests, please open an issue on GitHub.\n\nPlease:\n\n1. Fork the repository\n2. Create your feature branch\n3. Submit a pull request\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](LICENSE).\n\n## 🌱 Treeware\n\nThis package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/devrabiul/laravel-cookie-consent) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.\n\n## Contact\n\nFor support or inquiries, please reach out to us at [Send Mail](mailto:devrabiul@gmail.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrabiul%2Flaravel-cookie-consent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevrabiul%2Flaravel-cookie-consent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrabiul%2Flaravel-cookie-consent/lists"}