PHPackages                             edulazaro/wirecookies - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. edulazaro/wirecookies

ActiveLibrary[Templating &amp; Views](/categories/templating)

edulazaro/wirecookies
=====================

Drop-in cookie consent banner + preferences modal for Laravel apps. Themeable through the wire\* family CSS variables — shares look with wiremodal and wiretoast.

1.0.0(yesterday)04↑2900%MITCSSPHP ^8.2

Since Jun 30Pushed yesterdayCompare

[ Source](https://github.com/edulazaro/wirecookies)[ Packagist](https://packagist.org/packages/edulazaro/wirecookies)[ RSS](/packages/edulazaro-wirecookies/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

[![Wirecookies](art/banner.png)](art/banner.png)

Wirecookies
===========

[](#wirecookies)

Drop-in cookie consent banner and preferences modal for Laravel, Livewire and Alpine. Pure CSS, no Tailwind. Themeable through the `wire*` family CSS variables, so it shares its look with [wiremodal](https://github.com/edulazaro/wiremodal) and [wiretoast](https://github.com/edulazaro/wiretoast). GDPR / AEPD friendly: granular categories, re-openable preferences, multilingual, and it tracks nothing of its own.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- Alpine.js (already shipped with Livewire)
- [edulazaro/wiremodal](https://github.com/edulazaro/wiremodal) — pulled in automatically; it powers the preferences modal and provides the shared theme tokens.

Features
--------

[](#features)

- Bottom banner **and** an accessible preferences modal from a single `` tag.
- Granular categories (essential always on; analytics / marketing / functional opt-in), persisted in `localStorage`.
- Re-openable: a floating button lets users change or withdraw consent at any time (AEPD requirement).
- Works standalone with a clean light default; optionally set `data-wire-theme` (with wiremodal/wiretoast loaded) and it adopts that theme so banner, modal and toasts match.
- Multilingual: ships Spanish and English; every string is translatable and overridable per prop.
- Configurable policy link: a single URL or one per locale.
- Emits a `wirecookies-saved` event and writes a plain `localStorage` object you can read from anywhere.

Install
-------

[](#install)

```
composer require edulazaro/wirecookies
```

The service provider is auto-discovered.

Wirecookies ships a single stylesheet (`wirecookies.css`) and **no JS of its own** — it relies on Alpine and on wiremodal's JS for the modal.

### Styles (Vite)

[](#styles-vite)

Import the stylesheet from your `resources/css/app.css`, after a `wire*` family base (wiremodal or wiretoast) that defines the theme tokens:

```
/* resources/css/app.css */
@import '../../vendor/edulazaro/wiremodal/resources/css/wiremodal.css';
@import '../../vendor/edulazaro/wirecookies/resources/css/wirecookies.css';
```

Bundle wiremodal's JS too (needed to open/close the preferences modal):

```
// resources/js/app.js
import '../../vendor/edulazaro/wiremodal/resources/js/wiremodal.js';
```

Prefer a copy you can edit? Publish the CSS into your app and `@import` that instead:

```
php artisan vendor:publish --tag=wirecookies-css
# → resources/css/vendor/wirecookies.css
```

### Publish config, translations and views (optional)

[](#publish-config-translations-and-views-optional)

```
php artisan vendor:publish --tag=wirecookies-config   # → config/wirecookies.php
php artisan vendor:publish --tag=wirecookies-lang     # → lang/vendor/wirecookies/{locale}/wirecookies.php
php artisan vendor:publish --tag=wirecookies-views    # → resources/views/vendor/wirecookies
```

Usage
-----

[](#usage)

Drop the component **once**, near the end of your layout:

```

```

First-time visitors get the banner. Once they choose, the banner is replaced by a floating button that reopens the preferences modal.

### Theming

[](#theming)

Wirecookies styles itself: its CSS ships sensible light defaults, so it looks right on its own with nothing else loaded. Each token is also wired to the shared `--wire-*` family variables, so if you set `data-wire-theme` on a parent — with wiremodal or wiretoast loaded, since they define those variables — wirecookies automatically adopts that theme and matches your modals and toasts:

```

```

Without it, the built-in defaults apply. Wirecookies doesn't ship its own named theme catalog — it borrows the family's. See wiremodal/wiretoast for the available themes.

### Configuration

[](#configuration)

Edit `config/wirecookies.php` after publishing it:

KeyDescription`policy_url`Link to your cookie policy. A **string** (same for every language) or an **array per locale** (`['es' => '/cookies', 'en' => '/en/cookies']`). `null` hides the link.`delay`Milliseconds before the banner appears (default `800`).`categories`The consent groups. Each holds **behavior only** (`required`, `default`); the text comes from translations. Add `label` / `description` to a category here to override its translation.`storage_key``localStorage` key for the saved preferences (default `cookie-preferences`).### Reading consent

[](#reading-consent)

Preferences are a plain object in `localStorage`, and they are broadcast whenever the user saves:

```
// Read the current choice anywhere
const prefs = JSON.parse(localStorage.getItem('cookie-preferences') || '{}');
if (prefs.analytics) { /* load analytics */ }

// React to changes (the event bubbles to window)
window.addEventListener('wirecookies-saved', (e) => {
    if (e.detail.marketing) { /* enable marketing pixels */ }
});
```

Internationalization
--------------------

[](#internationalization)

Wirecookies ships Spanish (`es`) and English (`en`). Strings follow `app()->getLocale()` and fall back to `app.fallback_locale`.

- **Override one string** at render time by passing the matching prop (`:title`, `:accept-all`, …).
- **Customize the bundled copy** by publishing the translations:

    ```
    php artisan vendor:publish --tag=wirecookies-lang
    ```

    Then edit `lang/vendor/wirecookies/{locale}/wirecookies.php`. Add a new language by creating its file in the same folder.

Component props
---------------

[](#component-props)

All props are optional. Text props default to the translation; pass one to override it for that render.

PropDefaultDescription`policy-url`configCookie policy link (string or per-locale array).`delay`configMilliseconds before the banner shows.`categories`configOverride the consent groups.`storage-key`config`localStorage` key.`title`translationBanner / floating-button title.`description`translationBanner description.`accept-all`translation"Accept all" button.`reject-all`translation"Reject all" button.`configure`translation"Configure" button.`save-preferences`translationModal save button.`reject-optional`translationModal reject-optional button.`more-policy`translationInline policy link in the banner.`view-full-policy`translationPolicy link in the modal footer.`modal-title`translationPreferences modal title.`always-active`translationBadge on required (essential) categories.Sponsors
--------

[](#sponsors)

Wirecookies is supported by the following sponsors. Thank you for keeping it growing:

 [![Kenodo](art/logo-kenodo.png)](https://kenodo.com) [Kenodo](https://kenodo.com) [![AndorraDev](art/logo-andorradev.png)](https://andorradev.com) [AndorraDev](https://andorradev.com)

Author
------

[](#author)

Created by [Edu Lazaro](https://edulazaro.com)

License
-------

[](#license)

Wirecookies is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a3c47449dfb2ec121aa410da024f47586b87cc2799a825f0418e6c5e5904955?d=identicon)[edulazaro](/maintainers/edulazaro)

---

Top Contributors

[![edulazaro](https://avatars.githubusercontent.com/u/7797530?v=4)](https://github.com/edulazaro "edulazaro (4 commits)")

---

Tags

laravelbladecookiesalpinegdprconsentrgpd

### Embed Badge

![Health badge](/badges/edulazaro-wirecookies/health.svg)

```
[![Health](https://phpackages.com/badges/edulazaro-wirecookies/health.svg)](https://phpackages.com/packages/edulazaro-wirecookies)
```

###  Alternatives

[robsontenorio/mary

Gorgeous UI components for Livewire powered by daisyUI and Tailwind

1.5k531.0k21](/packages/robsontenorio-mary)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5452.7k](/packages/hasinhayder-tyro-dashboard)[technikermathe/blade-lucide-icons

A package to easily make use of Lucide icons in your Laravel Blade views.

18379.7k9](/packages/technikermathe-blade-lucide-icons)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2453.7k5](/packages/hasinhayder-tyro-login)[wendelladriel/slidewire

Create beautiful presentations powered by Livewire

1342.9k](/packages/wendelladriel-slidewire)[ublabs/blade-simple-icons

A package to easily make use of Simple Icons in your Laravel Blade views.

1958.8k](/packages/ublabs-blade-simple-icons)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
