├── resources ├── views │ ├── .gitkeep │ ├── dialogContents.blade.php │ └── index.blade.php └── lang │ ├── en │ └── filament-cookie-consent.php │ ├── it │ └── filament-cookie-consent.php │ ├── nl │ └── filament-cookie-consent.php │ └── es │ └── filament-cookie-consent.php ├── screenshots ├── top.png └── bottom.png ├── config └── filament-cookie-consent.php ├── src ├── Facades │ └── FilamentCookieConsent.php ├── FilamentCookieConsent.php └── FilamentCookieConsentServiceProvider.php ├── database ├── migrations │ └── create_skeleton_table.php.stub └── factories │ └── UserFactory.php ├── LICENSE.md ├── composer.json ├── CHANGELOG.md └── README.md /resources/views/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /screenshots/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcogermani87/filament-cookie-consent/HEAD/screenshots/top.png -------------------------------------------------------------------------------- /screenshots/bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcogermani87/filament-cookie-consent/HEAD/screenshots/bottom.png -------------------------------------------------------------------------------- /resources/lang/en/filament-cookie-consent.php: -------------------------------------------------------------------------------- 1 | 'Privacy Policy', 5 | ]; 6 | -------------------------------------------------------------------------------- /resources/lang/it/filament-cookie-consent.php: -------------------------------------------------------------------------------- 1 | 'Privacy Policy', 5 | ]; 6 | -------------------------------------------------------------------------------- /resources/lang/nl/filament-cookie-consent.php: -------------------------------------------------------------------------------- 1 | 'Privacybeleid', 5 | ]; 6 | -------------------------------------------------------------------------------- /resources/lang/es/filament-cookie-consent.php: -------------------------------------------------------------------------------- 1 | 'Política de privacidad', 5 | ]; 6 | -------------------------------------------------------------------------------- /config/filament-cookie-consent.php: -------------------------------------------------------------------------------- 1 | 'start', 6 | 7 | 'consent_button' => [ 8 | 'size' => 'sm', 9 | 'color' => 'warning', 10 | ], 11 | 12 | 'privacy_policy_button' => [ 13 | 'enabled' => true, 14 | 'href' => '/privacy-policy', 15 | 'size' => 'sm', 16 | 'color' => 'gray', 17 | 'target' => '_blank', 18 | ], 19 | ]; 20 | -------------------------------------------------------------------------------- /src/Facades/FilamentCookieConsent.php: -------------------------------------------------------------------------------- 1 | id(); 13 | 14 | // add fields 15 | 16 | $table->timestamps(); 17 | }); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->name, 16 | 'email' => $this->faker->unique()->safeEmail, 17 | ]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/FilamentCookieConsent.php: -------------------------------------------------------------------------------- 1 | renderHook( 21 | $position == 'start' ? PanelsRenderHook::HEAD_START : PanelsRenderHook::BODY_END, 22 | fn () => view('filament-cookie-consent::index'), 23 | ); 24 | } 25 | 26 | public function boot(Panel $panel): void {} 27 | 28 | public static function make(): static 29 | { 30 | return app(static::class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Marco Germani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/FilamentCookieConsentServiceProvider.php: -------------------------------------------------------------------------------- 1 | name('filament-cookie-consent') 23 | ->hasConfigFile() 24 | ->hasViews() 25 | ->hasTranslations() 26 | ->hasViewComposer('filament-cookie-consent::index', function (View $view) { 27 | $cookieConsentConfig = config('cookie-consent'); 28 | $pluginConfig = config('filament-cookie-consent'); 29 | $alreadyConsentedWithCookies = Cookie::has($cookieConsentConfig['cookie_name']); 30 | $view->with(compact( 31 | 'alreadyConsentedWithCookies', 32 | 'cookieConsentConfig', 33 | 'pluginConfig', 34 | )); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /resources/views/dialogContents.blade.php: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /resources/views/index.blade.php: -------------------------------------------------------------------------------- 1 | @if($cookieConsentConfig['enabled'] && ! $alreadyConsentedWithCookies) 2 | 3 | @include('filament-cookie-consent::dialogContents') 4 | 5 | 55 | 56 | @endif 57 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marcogermani87/filament-cookie-consent", 3 | "description": "Easy cookie consent integrations for Filament", 4 | "keywords": [ 5 | "marcogermani87", 6 | "laravel", 7 | "filament", 8 | "php", 9 | "cookie" 10 | ], 11 | "homepage": "https://github.com/marcogermani87/filament-cookie-consent", 12 | "license": "MIT", 13 | "authors": [ 14 | { 15 | "name": "Marco Germani", 16 | "email": "info@marcogermani.it", 17 | "role": "Developer" 18 | } 19 | ], 20 | "require": { 21 | "php": "^8.1", 22 | "filament/filament": "^3.0", 23 | "illuminate/contracts": "^10.0|^11.0|^12.0", 24 | "laravel/framework": "^10.0|^11.0|^12.0", 25 | "spatie/laravel-package-tools": "^1.16", 26 | "spatie/laravel-cookie-consent": "^3.0" 27 | }, 28 | "require-dev": { 29 | "laravel/pint": "^1.0", 30 | "nunomaduro/collision": "^7.9|^8.0", 31 | "orchestra/testbench": "^8.0|^9.0|^10.0", 32 | "pestphp/pest": "^2.0|^3.7", 33 | "pestphp/pest-plugin-arch": "^2.0|^3.0", 34 | "pestphp/pest-plugin-laravel": "^2.0|^3.1", 35 | "pestphp/pest-plugin-livewire": "^2.1|^3.0", 36 | "larastan/larastan": "^2.0|^3.0" 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "MarcoGermani87\\FilamentCookieConsent\\": "src/", 41 | "MarcoGermani87\\FilamentCookieConsent\\Database\\Factories\\": "database/factories/" 42 | } 43 | }, 44 | "autoload-dev": { 45 | "psr-4": { 46 | "MarcoGermani87\\FilamentCookieConsent\\Tests\\": "tests/" 47 | } 48 | }, 49 | "scripts": { 50 | "post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi", 51 | "analyse": "vendor/bin/phpstan analyse", 52 | "test": "vendor/bin/pest", 53 | "test-coverage": "vendor/bin/pest --coverage", 54 | "format": "vendor/bin/pint" 55 | }, 56 | "config": { 57 | "sort-packages": true, 58 | "allow-plugins": { 59 | "pestphp/pest-plugin": true, 60 | "phpstan/extension-installer": true 61 | } 62 | }, 63 | "extra": { 64 | "laravel": { 65 | "providers": [ 66 | "MarcoGermani87\\FilamentCookieConsent\\FilamentCookieConsentServiceProvider" 67 | ], 68 | "aliases": { 69 | "Skeleton": "MarcoGermani87\\FilamentCookieConsent\\Facades\\FilamentCookieConsent" 70 | } 71 | } 72 | }, 73 | "minimum-stability": "dev", 74 | "prefer-stable": true 75 | } 76 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `filament-cookie-consent` will be documented in this file. 4 | 5 | ## v1.2.0 - 2025-12-02 6 | 7 | ### What's Changed 8 | 9 | * Bump stefanzweifel/git-auto-commit-action from 6 to 7 by @dependabot[bot] in https://github.com/marcogermani87/filament-cookie-consent/pull/9 10 | * Bump actions/checkout from 5 to 6 by @dependabot[bot] in https://github.com/marcogermani87/filament-cookie-consent/pull/10 11 | 12 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.1.2...v1.2.0 13 | 14 | ## v1.1.2 - 2025-08-14 15 | 16 | ### What's Changed 17 | 18 | * Bump aglipanci/laravel-pint-action from 2.5 to 2.6 by @dependabot[bot] in https://github.com/marcogermani87/filament-cookie-consent/pull/7 19 | * Bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot[bot] in https://github.com/marcogermani87/filament-cookie-consent/pull/6 20 | * Bump actions/checkout from 4 to 5 by @dependabot[bot] in https://github.com/marcogermani87/filament-cookie-consent/pull/8 21 | 22 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.1.1...v1.1.2 23 | 24 | ## v1.1.1 - 2025-05-25 25 | 26 | ### What's Changed 27 | 28 | ### What's Changed 29 | 30 | * Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 by @dependabot in https://github.com/marcogermani87/filament-cookie-consent/pull/4 31 | * Add Spanish translation by @gboquizosanchez in https://github.com/marcogermani87/filament-cookie-consent/pull/5 32 | 33 | ### New Contributors 34 | 35 | * @gboquizosanchez made their first contribution in https://github.com/marcogermani87/filament-cookie-consent/pull/5 36 | 37 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.1.0...v1.1.1 38 | 39 | ## v1.1.0 - 2025-02-25 40 | 41 | ### What's Changed 42 | 43 | * Compatibility with Laravel 12.x 44 | * Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 by @dependabot in https://github.com/marcogermani87/filament-cookie-consent/pull/1 45 | * Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 by @dependabot in https://github.com/marcogermani87/filament-cookie-consent/pull/2 46 | * Bump aglipanci/laravel-pint-action from 2.4 to 2.5 by @dependabot in https://github.com/marcogermani87/filament-cookie-consent/pull/3 47 | 48 | ### New Contributors 49 | 50 | * @dependabot made their first contribution in https://github.com/marcogermani87/filament-cookie-consent/pull/1 51 | 52 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.0.2...v1.1.0 53 | 54 | ## v1.0.2 - 2024-05-13 55 | 56 | ### What's Changed 57 | 58 | * Managed default value for null configurations 59 | 60 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.0.1...v1.0.2 61 | 62 | ## v1.0.1 - 2024-05-13 63 | 64 | ### What's Changed 65 | 66 | * Fixed cookie consent sticky class 67 | 68 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/compare/v1.0.0...v1.0.1 69 | 70 | ## v1.0.0 - 2024-05-12 71 | 72 | ### What's Changed 73 | 74 | * First release 75 | 76 | **Full Changelog**: https://github.com/marcogermani87/filament-cookie-consent/commits/v1.0.0 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | [![Latest Version on Packagist](https://img.shields.io/packagist/v/marcogermani87/filament-cookie-consent.svg?style=flat-square)](https://packagist.org/packages/marcogermani87/filament-cookie-consent) 6 | [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/marcogermani87/filament-cookie-consent/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/marcogermani87/filament-cookie-consent/actions?query=workflow%3Arun-tests+branch%3Amain) 7 | [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/marcogermani87/filament-cookie-consent/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/:vendor_slug/filament-cookie-consent/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) 8 | [![Total Downloads](https://img.shields.io/packagist/dt/marcogermani87/filament-cookie-consent.svg?style=flat-square)](https://packagist.org/packages/marcogermani87/filament-cookie-consent) 9 | 10 | A package to easily include cookie consent in [Filament](https://filamentphp.com). 11 | 12 | This project is based on [spatie/laravel-cookie-consent](https://github.com/spatie/laravel-cookie-consent) package. 13 | 14 | ## Version Compatibility 15 | 16 | | Plugin | Filament | Laravel | PHP | 17 | | ------------- | ------------- | ------------- | -------------| 18 | | 1.x | 3.x | 10.x | 8.x | 19 | | 1.x | 3.x | 11.x \| 12.x | 8.2 \| 8.3 \| 8.4 | 20 | 21 | ## Installation 22 | 23 | You can install the package via composer: 24 | 25 | ```bash 26 | composer require marcogermani87/filament-cookie-consent 27 | ``` 28 | 29 | You can publish the config file with: 30 | 31 | ```bash 32 | php artisan vendor:publish --tag="filament-cookie-consent-config" 33 | ``` 34 | 35 | This is the contents of the published config file: 36 | 37 | ```php 38 | return [ 39 | // 'start', 'end' 40 | 'position' => 'start', 41 | 42 | 'consent_button' => [ 43 | 'size' => 'sm', 44 | 'color' => 'warning', 45 | ], 46 | 47 | 'privacy_policy_button' => [ 48 | 'enabled' => true, 49 | 'href' => '/privacy-policy', 50 | 'size' => 'sm', 51 | 'color' => 'gray', 52 | 'target' => '_blank', 53 | ], 54 | ]; 55 | ``` 56 | 57 | Optionally, you can publish the views using 58 | 59 | ```bash 60 | php artisan vendor:publish --tag="filament-cookie-consent-views" 61 | ``` 62 | 63 | ## Usage 64 | 65 | Register the plugin through your panel service provider: 66 | 67 | ```php 68 | ->plugin(\MarcoGermani87\FilamentCookieConsent\FilamentCookieConsent::make()) 69 | ``` 70 | 71 | ## Testing 72 | 73 | ```bash 74 | composer test 75 | ``` 76 | 77 | ## Screenshots 78 | 79 | ![](https://raw.githubusercontent.com/marcogermani87/filament-cookie-consent/main/screenshots/bottom.png) 80 | 81 | ![](https://raw.githubusercontent.com/marcogermani87/filament-cookie-consent/main/screenshots/top.png) 82 | 83 | ## Changelog 84 | 85 | Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. 86 | 87 | ## Credits 88 | 89 | - [Marco Germani](https://github.com/marcogermani87) 90 | - [All Contributors](../../contributors) 91 | 92 | ## License 93 | 94 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 95 | --------------------------------------------------------------------------------