Download the PHP package statikbe/laravel-cookie-consent without Composer

On this page you can find all versions of the php package statikbe/laravel-cookie-consent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cookie-consent

Laravel cookie consent modal

Latest Version on Packagist Total Downloads

Cookie banner and preferences modal for Laravel. Visitors choose which cookie categories they accept; Google Tag Manager reads the resulting cookie to decide which tags fire. Based on spatie/laravel-cookie-consent with added per-category consent.

Requirements

Laravel PHP
10–13 8.0+

Upgrading

See upgrading.md.

Table of contents

Installation

1. Install via Composer

The package registers itself automatically.

2. Register the middleware

Laravel 11 and later — in bootstrap/app.php:

Or as a named alias:

Laravel 10 and earlier — in app/Http/Kernel.php:

Or as a named middleware applied to specific routes:

The middleware injects the cookie consent snippet into every HTML response before the closing </body> tag.

3. Publish the assets

4. Include the stylesheet (default theme only)

Add this to your base template. Skip this step if you are using the Filament theme — see Filament Integration.

Configuration

Publish the config file:

config/cookie-consent.php:

Hiding the banner on specific pages

Wildcards use Laravel's Str::is() matching.

Hiding the banner on error pages

Filament Integration

If your project uses Filament, you can render the cookie banner using Filament components instead of the default styled theme.

1. Enable the Filament theme

This will render the cookie popup using Filament components:

The default theme looks like this for comparison:

2. Configure Tailwind to scan the package views

Tailwind v4 — in your main CSS file:

Tailwind v3 — in tailwind.config.js:

3. Filament styles outside the panel

If you display the cookie banner on pages that are not inside a Filament panel, include Filament's CSS and JS in those page templates.

4. Cookie settings nav item

When the Filament theme is active, the package registers a "Cookie settings" link in the Filament user menu. The position is controlled by filament-nav-item-render-hook, which defaults to after the profile menu item.

To change the position, set a different render hook value:

To remove the nav item entirely:

Customisation

Translations

Publish the language files:

Files land in lang/vendor/cookie-consent/{locale}/texts.php. To add a new locale, copy the en directory to the target locale and translate the strings.

Views

Publish the view files:

Files land in resources/views/vendor/cookie-consent.

To let visitors re-open the preferences modal (e.g. from your footer next to the cookie policy link):

Google Tag Manager

Set up GTM to read the consent cookie and control which tags fire. Full setup instructions: docs/google-tag-manager.md.

Security

If you discover a security issue, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-cookie-consent with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/http Version ^10.0|^11.0|^12|^13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package statikbe/laravel-cookie-consent contains the following files

Loading the files please wait ...