Download the PHP package fet/laravel-cookie-consent without Composer
On this page you can find all versions of the php package fet/laravel-cookie-consent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fet/laravel-cookie-consent
More information about fet/laravel-cookie-consent
Files in fet/laravel-cookie-consent
Package laravel-cookie-consent
Short Description A simple Laravel wrapper around the orestbida/cookieconsent package.
License MIT
Homepage https://github.com/f-e-t/laravel-cookie-consent
Informations about the package laravel-cookie-consent
Introduction
The fet/laravel-cookie-consent
package is a simple Laravel wrapper around the orestbida/cookieconsent package.
Installation
composer require fet/laravel-cookie-consent
php artisan vendor:publish --provider="Fet\CookieConsent\CookieConsentServiceProvider" --tag="config"
Configuration
The configuration consists of four keys: enable
, routes
, paths
and config
. The config
value is an array representation of the Configuration object and is passed to the CookieConsent package as JSON. Feel free to configure the package as you like.
POST Route
The Callback/Events are not directly configurable. Instead you can define a routes.post
which corresponds to an existing route name which is then called via POST request when the events onFirstConsent
or onChange
are triggered.
If the
routes.post
is empty, no POST request is sent.
The data received by the controller looks like this:
Redirect Route
If you want to perform a page redirect after the user has made the cookie consent choice, you can provide a route name to routes.redirect
.
If the
routes.redirect
is empty, no redirect is made.
Exclude Paths
To exclude the cookie consent from appearing on certain URL paths, add those paths to the paths.exclude
configuration array.
You can use valid regex patterns. For example, to exclude all
/admin/*
paths, addadmin(\/.*)?
to the exclude array.
Events
Sometimes you may need to change the configuration, after the application is booted. You can do so by listening to the \Fet\CookieConsent\Events\ConfigLoaded
event.
Tests
Run the tests with:
All versions of laravel-cookie-consent with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/events Version ^10.0|^11.0|^12.0
fet/laravel-php-to-js Version ^0.2