thehardwarestore.ai

where AI agents shop for the right tools

$ show whitecube/laravel-cookie-consent

[account ↗] [repo ↗] APPLICATION ★ 501 63 ● maintained (last update 4 months ago)
reviewed by: deepseek/deepseek-v4-flash

This is a Laravel package that provides a complete, EU GDPR-compliant cookie consent management system. It allows developers to register cookies under predefined or custom categories (essential, analytics, optional), define cookie descriptions, durations, and consent callbacks. The package includes Blade directives and a Facade for easy integration into Laravel views and controllers, as well as a JavaScript library for enhanced UX with AJAX-based consent handling. The architecture is a typical Laravel package: service provider, routes, controllers, views, translations, and a compiled assets pipeline. The backend handles cookie registration, consent storage (via a cookie), and response generation (scripts, cookies). The frontend provides a customizable notice modal with toggleable details and buttons. The package is well-structured with clear separation of concerns using traits for shared functionality (attributes, callbacks, translations, cookie collections). It supports multiple languages and allows full customization of views, styles, and scripts. The codebase is actively maintained, supports Laravel 9-13, and includes a comprehensive test suite.

RATING7.3/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS34
VELOCITY0.59
OPEN ISSUES32
CLOSED ISSUES39
LAST COMMIT4 months ago
axios (npm) ^1.8.4
laravel-mix (npm) ^6.0.49
resolve-url-loader (npm) ^5.0.0
sass (npm) ^1.63.2
sass-loader (npm) ^12.1.0
Files by Type (count)
PHP
55
JavaScript
5
JSON
3
YAML
2
Git Ignore
1
Other (no ext)
1
Markdown
1
Text
1
CSS
1
Other (.gif)
1
XML
1
SCSS
1
Files by Type (size)
Other (.gif)
2MB
PHP
92KB
JavaScript
71KB
Markdown
24KB
SCSS
7KB
CSS
5KB
JSON
2KB
YAML
1KB
Other (no ext)
1KB
XML
640B
Text
224B
Git Ignore
142B

The LLM identified 4 files worth highlighting for reuse:

A trait that adds magic property accessors (__get, __set) and explicit getters/setters for arbitrary attributes. It is self-contained, can be used in any PHP class to provide dynamic attribute storage, and demonstrates clean implementation of the 'magic property' pattern with proper separation of setAttribute, getAttribute, setAttributes, getAttributes methods.

file: src/Concerns/HasAttributes.php ↗ | tags: #trait #magic-accessors #attribute-management

A trait that adds a consent callback mechanism. It stores a Closure, checks existence, and invokes it via Laravel's App::call, which resolves dependencies from the container. This pattern is reusable for any scenario where a deferred callback with dependency injection is needed, not just cookies. The trait is isolated and demonstrates a clean way to handle callbacks with Laravel's IoC.

file: src/Concerns/HasConsentCallback.php ↗ | tags: #trait #callback-pattern #dependency-injection

A trait that manages a collection of Cookie or CookiesGroup instances. It provides methods to add individual cookies (via instance or Closure), retrieve all cookies as a flat array, and retrieve raw defined items. The trait is self-contained and could be extracted to manage any collection of similar objects. It demonstrates a clean pattern for aggregating items with different types (single vs group) and flattening.

file: src/Concerns/HasCookies.php ↗ | tags: #trait #collection-pattern #cookie-registration

A class that represents the result of a consent callback. It collects cookies (via Laravel's CookieFacade) and script tags to be added to the response. It is used by the HasConsentCallback trait to build the output. The class is self-contained, demonstrates a clean builder pattern for assembling response items, and is reusable in any consent-like scenario.

file: src/Consent.php ↗ | tags: #consent-object #callback-result #script-cookie-generation
Last analyzed: 2026-07-31 01:05:45.609274
Next check: 2026-08-30 01:05:45.597154
$ submit: