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

The package includes a script & styling for a cookie banner and a modal where the visitor can select his/her cookie preferences.

This package is mainly based on the one from spatie: https://github.com/spatie/laravel-cookie-consent

With the only exception that you can choose which cookies you enable. This only works when Google Tag Manager is correctly configured (some regex config based on the value set in the cookie).

Upgrading

You can find our upgrading guides here.

Installation

You can install the package via composer:

The package will automatically register itself.

First of all you need to publish the javascript and css files:

Include the css/cookie-consent.css into your base.blade.php or any other base template you use.

The javascript file is included in the cookie snippet and will be added at the end of your body.

Usage

Instead of including a snippet in your view, we will automatically add it. This is done using middleware using two methods:

  1. The first option: include it in your entire project using the kernel:

  2. The second option: include it as a route middleware and add this to any route you want.

This will add cookieConsent::index to the content of your response right before the closing body tag.

Customising the dialog texts

If you want to modify the text shown in the dialog you can publish the lang-files with this command:

This will publish this file to resources/lang/vendor/cookieConsent/en/texts.php.

If you want to translate the values to, for example, English, just copy that file over to resources/lang/vendor/cookieConsent/fr/texts.php and fill in the English translations.

Customising the dialog contents

If you need full control over the contents of the dialog. You can publish the views of the package:

This will copy the index view file over to resources/views/vendor/cookieConsent.

The cookie-settings view file is just a snippet you need to place somewhere onto your page. Most preferably in the footer next to the url of your cookie policy.

This gives your visitor the opportunity to change the settings again.

Publishing

Config

This is the contents of the published config-file: This will read the policy urls from your env.

You can customize some settings that work with your GTM.

Don't show modal on cookie policy page or other pages

If you don't want the modal to be shown on certain pages you can add the relative url to the ignored paths setting. This also accepts wildcards (see the Laravel Str::is() helper).

Translations

Views

Configure Google Tag Manager

All the steps to configure your Google Tag Manager can be found here.

Security

If you discover any security related issues, 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 ^9.0|^10.0|^11.0
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 ....