{"id":28720257,"url":"https://github.com/weble/laravel-filament-cookiebar","last_synced_at":"2025-06-15T06:33:25.155Z","repository":{"id":218074885,"uuid":"743944066","full_name":"Weble/laravel-filament-cookiebar","owner":"Weble","description":"GDPR compliant Cookiebar integrated with Google Tag Manager Consent Mode v2 for Laravel using Filament and Livewire","archived":true,"fork":false,"pushed_at":"2025-03-10T04:28:58.000Z","size":728,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T00:15:23.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Weble.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Weble"}},"created_at":"2024-01-16T10:14:35.000Z","updated_at":"2025-03-10T16:52:33.000Z","dependencies_parsed_at":"2024-01-22T05:31:07.902Z","dependency_job_id":"265f470d-1b33-430b-932f-26b327b93d38","html_url":"https://github.com/Weble/laravel-filament-cookiebar","commit_stats":null,"previous_names":["weble/laravel-filament-cookiebar"],"tags_count":0,"template":false,"template_full_name":"filamentphp/plugin-skeleton","purl":"pkg:github/Weble/laravel-filament-cookiebar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weble%2Flaravel-filament-cookiebar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weble%2Flaravel-filament-cookiebar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weble%2Flaravel-filament-cookiebar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weble%2Flaravel-filament-cookiebar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Weble","download_url":"https://codeload.github.com/Weble/laravel-filament-cookiebar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Weble%2Flaravel-filament-cookiebar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259934738,"owners_count":22934329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-06-15T06:32:29.893Z","updated_at":"2025-06-15T06:33:25.144Z","avatar_url":"https://github.com/Weble.png","language":"PHP","funding_links":["https://github.com/sponsors/Weble"],"categories":[],"sub_categories":[],"readme":"# Laravel Filament CookieBar - GDPR and GTM friendly \n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/weble/laravel-filament-cookiebar.svg?style=flat-square)](https://packagist.org/packages/weble/laravel-filament-cookiebar)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/weble/laravel-filament-cookiebar/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/weble/laravel-filament-cookiebar/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/weble/laravel-filament-cookiebar.svg?style=flat-square)](https://packagist.org/packages/weble/laravel-filament-cookiebar)\n\nGDPR compliant Cookiebar integrated with Google Tag Manager Consent Mode v2 for Laravel using Filament and Livewire\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require weble/laravel-filament-cookiebar\n```\n\nYou can publish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"cookiebar-migrations\"\nphp artisan migrate\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"cookiebar-config\"\n```\n\nOptionally, you can publish the language files using\n\n```bash\nphp artisan vendor:publish --tag=cookiebar-lang\"\n```\n\nThis is the contents of the published config file:\n\n```php\n\u003c?php\n\nuse Weble\\LaravelFilamentCookieBar\\Enums\\GTMConsent;\n\nreturn [\n\n    /*\n     * Use this setting to enable the cookie consent dialog.\n     */\n    'enabled' =\u003e env('COOKIE_CONSENT_ENABLED', true),\n\n    /*\n     * The name of the cookie in which we store if the user\n     * has agreed to accept the conditions.\n     */\n    'cookie_name' =\u003e '_cookieConsents',\n\n    /*\n     * Set the cookie duration in days.  Default is 365 days.\n     */\n    'cookie_lifetime' =\u003e 365,\n\n    /**\n     * Route / url to the terms page\n     */\n    'terms_url' =\u003e '#',\n\n    /*\n     * Consents\n     * The key is the one used by GTM Consent Mode\n     */\n    'consent_groups' =\u003e [\n        'required' =\u003e [\n            'title' =\u003e 'cookiebar::consents.required.label',\n            'description' =\u003e 'cookiebar::consents.required.description',\n            'consents' =\u003e [\n                GTMConsent::SECURITY_STORAGE,\n                GTMConsent::FUNCTIONALITY_STORAGE,\n            ],\n            'disabled' =\u003e true,\n            'default' =\u003e true,\n        ],\n        'analytics' =\u003e [\n            'title' =\u003e 'cookiebar::consents.analytics.label',\n            'description' =\u003e 'cookiebar::consents.analytics.description',\n            'consents' =\u003e [\n                GTMConsent::ANALYTICS_STORAGE,\n                GTMConsent::PERSONALIZATION_STORAGE,\n            ],\n            'disabled' =\u003e false,\n            'default' =\u003e false,\n        ],\n        'marketing' =\u003e [\n            'title' =\u003e 'cookiebar::consents.marketing.label',\n            'description' =\u003e 'cookiebar::consents.marketing.description',\n            'consents' =\u003e [\n                GTMConsent::AD_STORAGE,\n                GTMConsent::AD_PERSONALIZATION,\n                GTMConsent::AD_USER_DATA,\n            ],\n            'disabled' =\u003e false,\n            'default' =\u003e false,\n        ],\n    ],\n];\n\n```\n\n## Usage\n\nThis package relies and depends on the awesome [Spatie Google Tag Manager](https://github.com/spatie/laravel-googletagmanager) package.\nTo integrate with Google Tag Manager's consent mode v2 (which is encouraged) you should configure this package first, and then proceed into integrating the CookieBar.\n\n### Basic Example\n\nFirst you'll need to include both the default GTM Consent Mode setup and GTM scripts into your head and body tags:\n\n```html\n{{-- layout.blade.php --}}\n\u003chtml\u003e\n  \u003chead\u003e\n    @include('cookiebar::head')\n    {{-- ... --}}\n  \u003c/head\u003e\n  \u003cbody\u003e\n    @include('googletagmanager::body')\n    {{-- ... --}}\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThe `cookiebar::head` layout already includes spatie's GTM code for the head, so don't include both theirs script and ours.\n\nYou can then place the Cookiebar livewire component anywhere you like, and you're done,\n```html\n{{-- layout.blade.php --}}\n\u003chtml\u003e\n  \u003chead\u003e\n    @include('cookiebar::head')\n    {{-- ... --}}\n  \u003c/head\u003e\n  \u003cbody\u003e\n    @include('googletagmanager::body')\n    {{-- ... --}}\n    \n    \u003clivewire:cookiebar /\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nIf you are in a Livewire full page component, or prefer having more control over what happens in the livewire component itself, you can use your own Livewire component and use the `HasCookieBar` trait to include all the functionalities you need\n\n```php\n\u003c?php\n\n// app/Livewire/YourComponent.php\nnamespace App\\Livewire;\n\nuse Filament\\Actions\\Concerns\\InteractsWithActions;\nuse Filament\\Actions\\Contracts\\HasActions;\nuse Filament\\Forms\\Concerns\\InteractsWithForms;\nuse Filament\\Forms\\Contracts\\HasForms;\nuse Illuminate\\Contracts\\View\\View;\nuse Livewire\\Component;\nuse Weble\\LaravelFilamentCookieBar\\Livewire\\HasCookieBar;\n\nclass YourComponent extends Component implements HasActions, HasForms\n{\n    use HasCookieBar;\n    use InteractsWithActions;\n    use InteractsWithForms;\n\n    public function render(): View\n    {\n        return view('livewire.your-component');\n    }\n}\n\n```\n```html\n\u003c!-- resources/views/livewire/your-component.blade.php --\u003e\n\u003cdiv\u003e\n    {{ $slot ?? '' }}\n\n    @if($showCookieBar)\n        \u003cdiv class=\"fixed bottom-0 w-full py-4 shadow-top bg-black text-white z-50\"\u003e\n            \u003cdiv class=\"container mx-auto flex flex-col items-center justify-center text-center lg:text-left space-y-4\"\u003e\n        \u003cspan class=\"cookiebar__message\"\u003e\n           {!! __('cookiebar::banner.message', ['href' =\u003e config('cookiebar.terms_url', '#')]) !!}\n        \u003c/span\u003e\n\n                \u003cdiv class=\"flex flex-col items-center justify-center space-y-4\"\u003e\n                    \u003cdiv class=\"flex justify-center items-center space-x-4\"\u003e\n                        {{ $this-\u003eshowCookieModalAction }}\n\n                        {{ $this-\u003eagreeAction }}\n                    \u003c/div\u003e\n\n                    {{ $this-\u003edismissAction }}\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    @endif\n\n    \u003cx-filament-actions::modals/\u003e\n\u003c/div\u003e\n\n```\n\nThe component will deal with creating the default consent status and sending the correct update events to GTM once the user accepts the cookies.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Daniele Rosario](https://github.com/Skullbock)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweble%2Flaravel-filament-cookiebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweble%2Flaravel-filament-cookiebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweble%2Flaravel-filament-cookiebar/lists"}