Download the PHP package stevecreekmore/cookies without Composer

On this page you can find all versions of the php package stevecreekmore/cookies. 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 cookies

Laravel Cookie Consent

Latest Version on Packagist Tests Total Downloads

A GDPR-compliant Laravel package for managing cookie consent with category-based consent management, script blocking, consent logging, and easy withdrawal.

Features

GDPR Compliance

This package helps you comply with GDPR by:

  1. Blocking Non-Essential Cookies - Scripts are blocked until consent is given
  2. Granular Consent - Users can choose specific cookie categories
  3. Detailed Information - Shows cookie names, purposes, durations, and providers
  4. Easy Withdrawal - Floating button to change preferences anytime
  5. Consent Logging - Audit trail stored in database (proof of consent)
  6. Privacy Policy Links - Direct links to your policies
  7. Opt-in by Default - No pre-checked boxes (except necessary cookies)

Installation

Install the package via composer:

The package will automatically register its service provider.

Publish Configuration

Publish the configuration file:

Publish Migrations (for consent logging)

Publish Views (Optional)

If you want to customize the banner appearance:

Add Middleware

Add the middleware to your bootstrap/app.php (Laravel 11+):

Or for Laravel 10 and below, add to app/Http/Kernel.php:

Configuration

Define Your Cookies

Edit config/cookies.php to define the specific cookies your site uses:

Set Policy URLs

Or in your .env:

Usage

Blocking Scripts Until Consent

The most important GDPR feature - scripts won't load until the user consents:

Method 1: Blade Directive (Recommended)

Method 2: Manual Script Blocking

The script will automatically be activated once the user consents to that category.

Checking Consent in PHP

Blade Conditional Directive

JavaScript Event Listener

React to consent changes in your JavaScript:

GDPR Compliance Features

1. Consent Logging (Audit Trail)

All consent actions are logged to the database:

2. Consent Withdrawal

A floating button appears after consent is given, allowing users to:

This is a GDPR requirement - withdrawal must be as easy as giving consent.

3. Detailed Cookie Information

Users can click "View Cookie Details" to see a table with:

4. Log Retention

Control how long consent logs are kept (GDPR requires keeping records):

Clean up old logs:

Or schedule it in app/Console/Kernel.php:

Customization

Styling

Customize appearance in config/cookies.php:

Custom Text

Change all text and labels:

Custom Banner View

After publishing views, edit resources/views/vendor/cookies/banner.blade.php for complete control.

Disable Consent Logging

If you don't need database logging:

Hide Settings Button

Testing

This package comes with a comprehensive test suite using Pest.

Running Tests

Test Coverage

The package includes 80+ test cases covering:

Requirements for Testing

The test suite requires:

All dependencies are automatically installed via composer install.

Best Practices for GDPR Compliance

  1. Document All Cookies - Fill in the cookies array for each category with specific cookie details
  2. Update Your Privacy Policy - Include information about cookie usage
  3. Block All Non-Essential Scripts - Use the Blade directive or manual blocking
  4. Keep Consent Logs - Enable database logging for proof of consent
  5. Regular Audits - Review what cookies your site actually sets
  6. Honor Withdrawals - The floating button makes this easy
  7. Third-Party Cookies - List all third-party providers clearly

API Reference

Facade Methods

Blade Directives

JavaScript Events

Troubleshooting

Scripts Not Loading After Consent

Make sure you're using type="text/plain" and the data-cookie-consent attribute:

Banner Not Showing

  1. Check middleware is added to web routes
  2. Ensure COOKIE_CONSENT_ENABLED=true in .env
  3. Check if consent cookie already exists (delete it to test)

Consent Not Being Logged

  1. Run migrations: php artisan migrate
  2. Check COOKIE_CONSENT_LOG=true in config
  3. Ensure CSRF token is present on the page: <meta name="csrf-token" content="{{ csrf_token() }}">

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of cookies with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/support Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.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 stevecreekmore/cookies contains the following files

Loading the files please wait ...