All notable changes to laravel-cookies-consent
will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
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"
-
JSON Cookie Storage: Cookies are now stored in a JSON object under a single key with the prefix specified in the configuration file. This change improves the structure and management of cookies.
-
Configuration File Changes: The configuration file format has been updated to reflect the new JSON cookie storage method. The
cookie_prefix
is now used to store cookies in a JSON object.
- JSON Cookie Storage: Cookies are now stored in a JSON object under a single key with the prefix specified in the configuration file. This change improves the structure and management of cookies.
hide_floating_button_on_mobile
option: A new configuration option has been added to hide the floating cookies button on mobile devices. This option allows you to control the visibility of the floating button based on the device type.- UI/UX Improvements: The cookies consent modal has been updated with improved styling and layout for a better user experience.
- Update the configuration file to reflect the new JSON cookie storage method:
- Ensure the
cookie_prefix
is set in theconfig/cookies_consent.php
file. - Update the
name
field of each cookie in thecookies
array to reflect the new JSON storage format.
Example:
'cookie_prefix' => 'my_app_',
'cookies' => [
'strictly_necessary' => [
[
'name' => 'my_app_cookies_consent',
'description' => 'This cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.',
'duration' => '2 years',
'policy_external_link' => null,
],
// other cookies...
],
'targeting' => [
// cookies...
],
],
- Update Blade Files
- Update the Blade files to reflect the new JSON cookie storage method. The
cookie
helper function is used to set and retrieve cookies from the JSON object.
Example:
@if(isset($_COOKIE[config('cookies_consent.cookie_prefix') . 'cookies_consent']))
@php
$cookiesConsent = json_decode($_COOKIE[config('cookies_consent.cookie_prefix') . 'cookies_consent'], true);
@endphp
@if(isset($cookiesConsent['targeting']) && $cookiesConsent['targeting'] && config('app.google_analytics_id'))
<!-- Google Analytics -->
<script defer async>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
window.ga('create', '{{ config('app.google_analytics_id') }}', 'auto');
window.ga('set', 'anonymizeIp', true);
window.ga('send', 'pageview');
</script>
@endif
@endif
- 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-assets" --force
- 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.
- Improved the UI design for smaller screens (phones & tablets)
- Fixed the width of the cookies container
The v2 of the Laravel Cookies Consent plugin has been released! 🎉🥳😍
This version includes some important changes and improvements, such as:
- A new configuration file format. Now you can declare the cookies each cookie category uses in a more structured way.
- A new, clean, and intuitive UI for the cookies consent modal.
- An option to present the cookies consent dialog in a separate page instead of a modal.
- A stick cookies button that allows users to change their cookies preferences at any time. This button is optional and it's existence can be tweaked in the configuration file.
- A separate page for the cookies preferences, where users can read more about each cookie category and change their preferences.
- Changed the background color of the "Allow all cookies" button, in order to be compliant with the GDPR rules
- Fixed the padding of the button texts
Added Portuguese Language corrections, thanks to this PR by ViNiSeNnAtt
Added Portuguese Language, thanks to this commit by ViNiSeNnAtt
Improvements regarding the styles file, Composer lib updates
List of Updates:
- Fixed z-index issue (as reported in #10)
- Now the front-end assets (styles) file is not automatically published, to avoid causing overriding (reported
in #11) - Composer libraries update
- Improved Development guidelines in Readme file
Notable Changes:
Now, in order to publish the styles file to public/vendor/cookies_consent/css/style.css
it is required to manually
run the publishing command:
php artisan vendor:publish \
--provider="SciFY\LaravelCookiesConsent\LaravelCookiesConsentServiceProvider" \
--tag="cookies-consent-assets"
This release addresses this issue, regarding the cookie prefix when accepting "all" cookies.
This is the first stable release of the plugin! Feel free to download, try and customize it. If you find any issues, please report them to the issue page. Check out the CONTRIBUTING.md guide to contribute to this open-source project!
The plugin now uses Laravel's app()->langPath()
method, in order to publish the translation files.
Set the required PHP version to either 7.x
or 8.x
, in order to accommodate older Laravel installations.
- Now the cookie prefix is set entirely from the configuration file. The trailing character should be set there.
- Improved UI design in smaller (phone & tablet) screens.
- The plugin is now ready to be tested and used in 3rd party Laravel apps.
Improved the overall design and fixed the width of the cookies container
- Added the ability to set cookie duration
- Fixed container width on larger screens
- Added remaining languages
- Improved README.md instructions
This is the initial release of the plugin. SciFY Team will start testing the plugin in our own projects and proceed to the release of version 1.0.0, when deem applicable.