Download the PHP package selli/laravel-gdpr-consent-database without Composer
On this page you can find all versions of the php package selli/laravel-gdpr-consent-database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download selli/laravel-gdpr-consent-database
More information about selli/laravel-gdpr-consent-database
Files in selli/laravel-gdpr-consent-database
Package laravel-gdpr-consent-database
Short Description A simple consent database for laravel applications to manage GDPR consents
License MIT
Homepage https://github.com/selli/laravel-gdpr-consent-database
Informations about the package laravel-gdpr-consent-database
Laravel GDPR Consent Database
A comprehensive Laravel package for managing GDPR consent in your applications. This package provides a complete solution for tracking user consents, managing consent types, and ensuring GDPR compliance.
Installation
You can install the package via composer:
Consent Categories
The package supports categorizing consent types to handle different types of consents appropriately:
cookie
- For cookie-related consents (technical, profiling, tracking, etc.)other
- For non-cookie consents (marketing, newsletters, etc.)
Cookie Banner Integration
The cookie banner automatically filters and displays only consent types with category 'cookie'
. Other consent types should be managed through your application's registration/preference flows.
You can publish and run the migrations with:
You can publish the config file with:
This is the contents of the published config file:
Optionally, you can publish the views using
Usage
Setup
After installing the package and running the migrations, you need to add the HasGdprConsents
trait to your User model or any other model that needs to manage GDPR consents:
Creating Consent Types
First, you need to create consent types that users can agree to:
Managing User Consents
Once you have set up consent types, you can manage user consents:
php // Create a consent type with version $consentType = ConsentType::create([ 'name' => 'Privacy Policy', 'slug' => 'privacy-policy', 'description' => 'Privacy Policy consent', 'required' => true, 'active' => true, 'version' => '1.0', ]);
// Create a new version when terms change $newVersion = $consentType->createNewVersion([ 'description' => 'Updated Privacy Policy consent', ]);
// Check if a user's consent is for the current version if ($user->hasConsent('privacy-policy', true)) { // User has consented to the current version } else { // User needs to renew consent for the new version }
// Get all consents that need renewal (expired or outdated version) $consentsNeedingRenewal = $user->consentsNeedingRenewal();
// Renew a consent with the latest version $user->renewConsent('privacy-policy'); bash php artisan db:seed --class="Selli\LaravelGdprConsentDatabase\Database\Seeders\CookieConsentSeeder" blade {{-- Basic usage --}} @gdprCookieBanner
{{-- With custom options --}} @gdprCookieBanner([ 'title' => 'Cookie Preferences', 'message' => 'We use cookies to improve your experience.', 'acceptText' => 'Accept All Cookies', 'rejectText' => 'Reject Optional', 'consentTypes' => $consentTypes ]) bash php artisan vendor:publish --tag="laravel-gdpr-consent-database-views" blade
bash composer test
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Filippo Calabrese](https://github.com/filippocalabrese)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
All versions of laravel-gdpr-consent-database with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0