Releases: scify/laravel-cookie-guard
v4.1.3 - UI Improvements
v4.1.3 - UI Improvements
- Fixed modal centering on some screens
- Improved docs
v4.1.2 - Fixed Back Scrolling & Button focus
v4.1.2 - Fixed Back Scrolling & Button focus
- Fixed the issue with the back scrolling of the page when the cookies consent modal is open.
- Fixed the issue with the button focus in Safari.
v4.1.1 - Ability to have a fully-accessible dialog
v4.1.1 - Improved Accessibility & Bug Fixes - 2025-04-03
We have decided to give the developers the ability to use the pure <dialog>
HTML element functionality for our cookie
consent component to enhance accessibility and ensure compliance with privacy regulations.
The <dialog>
element is designed to create a modal dialog that captures the user's focus, preventing interaction with
the rest of the webpage
until the dialog is dismissed.
This approach ensures that users must make a choice regarding cookie consent before they
can continue using the website. Read more here.
By using the <dialog>
element, we achieve the following benefits:
-
Improved Accessibility: The
<dialog>
element is natively supported by modern browsers and provides built-in
accessibility features. It ensures that screen readers and other assistive technologies can properly announce the
dialog and its contents to users with disabilities. -
Focus Management: When the dialog is open, it automatically captures the focus, preventing users from navigating
outside of it. This ensures that users cannot interact with other parts of the website until they have accepted or
rejected the cookies, making the consent process clear and unavoidable. -
Compliance with Privacy Regulations: By requiring users to make a choice before continuing to use the website, we
ensure compliance with privacy regulations such as the GDPR. This approach guarantees that users are informed about
and consent to the use of cookies before any data is collected.
Overall, the use of the <dialog>
element enhances the user experience by providing a clear and accessible way to
manage cookie consent, ensuring that all users can interact with our website in a compliant and user-friendly manner.
This functionality is now the default behavior of the plugin, and it can be disabled by setting the new use_floating_modal
flag in the config/cookies_consent.php
file to true
.
v4.0.1 - Fixed z-index and improved layout
v4.0.1 - Fixed z-index and improved layout
v4.0.0 - Multilingual Support & Better Theming
v4.0.0 - Multilingual Support & Better Theming - Breaking Changes in Configuration and Functionality - 2025-03-07
The plugin is now renamed to laravel-cookie-guard
and has undergone some major updates! 🎉🥳😍
Important:
Since the plugin now has a completely new name, you will need to uninstall the old package, and install the new one.
rm -rf public/vendor/scify && rm -rf vendor/scify
composer remove scify/laravel-cookies-consent
composer require scify/laravel-cookie-guard
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag="cookies-consent-public" --force
Then, make sure to check the configuration file config/cookies_consent.php
and update it according to the new one.
Then, make sure that the Laravel components you use are the new ones:
Intead of using:
<x-laravel-cookies-consent></x-laravel-cookies-consent>
Use:
<x-laravel-cookie-guard-scripts></x-laravel-cookie-guard-scripts>
<x-laravel-cookie-guard></x-laravel-cookie-guard>
Introduction
In order to conform with the European Union's General Data Protection Regulation (GDPR) and improve the user experience,
the Laravel Cookies Consent plugin has undergone a major update. This release includes a multi-language support in the
banner, in order to allow the banner to change when the locale
is changed. The plugin now supports multiple languages
in all the texts that are displayed to the user!
Also, in order to improve the flexibility and theming of the plugin, we now provide a _variables.css
file, which can
be used to customize the colors and fonts of the plugin. This file is located in the
public/vendor/scify/laravel-cookie-guard/styles
directory and can
be customized to match the design of your application.
New Features
- Multi-Language Support: The plugin now supports multiple languages in the banner and the cookies consent modal.
The texts displayed to the user can be translated based on thelocale
set in the application. By default, all 24
languages of the EU are supported. - Automatic locale detection: The plugin automatically detects the app's locale based on the Laravel locale, and
displays the banner in the corresponding language. - Customizable Theme: A
_variables.css
file is now being added to the
public/vendor/scify/laravel-cookie-guard/styles
directory, once you publish the front-end assets. This file can be used to customize the colors and fonts of the
plugin to match the design of your
application. - Cookies categories collapsed by default: The cookies categories are now collapsed by default in the cookies
consent modal. Users can expand each category to view the cookies included in that category. This can be tweaked in
theconfig/cookies_consent.php
file. - Improved UI/UX: The cookies consent modal has been updated with improved styling and layout for a better user
experience.
How to override the CSS styles
If you want to override the CSS styles of the cookies consent dialog, you can do this:
<x-laravel-cookie-guard></x-laravel-cookie-guard>
<style>
#scify-cookies-consent {
--scify-cookies-primary-color: #ff5722; /* Override primary color */
...
/* Add more override rules here */
}
</style>
The full list of CSS variables that can be overridden can be found in the
public/vendor/scify/laravel-cookie-guard/_variables.css
file.
Breaking Changes
The v4.0.0
release introduces significant changes to the config/cookies_consent.php
configuration file.
These changes are necessary to improve the flexibility and usability of the plugin. Below
are the details of the changes and the steps required to update your existing configuration.
Configuration File Changes
Cookie Categories:
The structure of the cookies
array has been updated to reflect the new multi-language support.
Each cookie now has their description derived from the language files, based on the locale
set in the application.
Cookie Duration:
Each cookie category now includes a description
, duration
, and duration_count
attributes.
For example, if you want to set the duration of a cookie to 2 years
, you can set the duration
to
cookies_consent::messages.years
and the duration_count
to 2
.
The plugin will automatically translate the duration text, based on the locale
set in the application.
Cookies categories collapsed by default:
The cookies categories are now collapsed by default in the cookies consent modal. Users can expand each category to view
the cookies included in that category. This can be tweaked in the config/cookies_consent.php
file, in the
categories_collapsed_by_default
key.
Migration Guide
- Backup your existing configuration file: Before updating to the new version, make sure to take a backup of your
existing
config/cookies_consent.php
file to avoid losing any custom settings. - Update the Configuration File: Run
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag=cookies-consent-config --force
and then ensure thecookie_prefix
is set in theconfig/cookies_consent.php
file. Update
the
description
,duration
, andduration_count
fields of each cookie in the cookies array to reflect the new
JSON
storage format. - Publish the Front-End Assets: Run the following command to publish the updated assets:
php artisan vendor:publish --provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" --tag="cookies-consent-public" --force
- Build the Laravel configuration cache: Run the following command to rebuild the configuration cache:
php artisan config:cache
- Test Your Application: Ensure that the cookies consent functionality works as expected with the new JSON storage
format. Verify that the cookies are correctly set and retrieved in the browser.
v3.1.4 - UI improvements & fixes
- Fixed the SCSS variable declaration for
--bs-accordion-border-color
- Improved the default font family to ensure a universal style
- Fixed some font sizes
v3.1.2 - Fixes for Bootstrap-based apps
v3.1.3 v3.1.3 - Fixes for Bootstrap-based apps
v3.1.2 - UI improvements in smaller screens
v3.1.2 - UI improvements in smaller screens
v3.1.1 - UI improvements in smaller screens
v3.1.1 - UI fixes in smaller screens
v3.1.0 - UI improvements and simplification of front-end assets.
v3.1.0 - Changes in assets files in the public - 2025-01-31
In order to simplify the installation process and avoid potential conflicts with existing assets, the front-end assets
are now included directly in the package and loaded from the vendor/scify/laravel-cookies-consent/
directory.
This means that the public/vendor/cookies_consent
directory should be deleted, and the assets should be published again:
In order to update to the new version, you need to remove the public/vendor/cookies_consent
directory and run the
asset publishing command:
rm -rf public/vendor/cookies_consent
And then:
php artisan vendor:publish \
--provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" \
--tag="cookies-consent-public"