PHPackages                             sebastiansulinski/laravel-cookies-dialog - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sebastiansulinski/laravel-cookies-dialog

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sebastiansulinski/laravel-cookies-dialog
========================================

Laravel Cookies Dialog

v1.1.0(3y ago)0163MITPHPPHP ^8.1

Since Oct 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sebastiansulinski/laravel-cookies-dialog)[ Packagist](https://packagist.org/packages/sebastiansulinski/laravel-cookies-dialog)[ Docs](https://github.com/sebastiansulinski/laravel-cookies-dialog)[ RSS](/packages/sebastiansulinski-laravel-cookies-dialog/feed)WikiDiscussions main Synced today

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

Laravel Cookie Dialog
=====================

[](#laravel-cookie-dialog)

This package adds simple functionality to manage cookie dialog on your website. It consists of the Controller, which expects request to indicate if third party cookies are being allowed or not and sets the cookie on user's machine accordingly.

You can either use your own front end implementation or use the examples towards the bottom of this page (vuejs/inertiajs/pinia/tailwindcss).

Installation
------------

[](#installation)

```
composer require sebastiansulinski/laravel-cookies-dialog

php artisan vendor:publish --tag=laravel-cookies-dialog
```

You will now have a `config/cookies-dialog.php` file available - feel free to update it to your heart's desire.

Pass shared variables to inertia's components
---------------------------------------------

[](#pass-shared-variables-to-inertias-components)

```
// App\Http\Middleware\HandleInertiaRequests.php

public function __construct(Request $request, private Share $share)
{
    //...
}

public function share(Request $request): array
{
    return array_merge(parent::share($request), $this->share->get());
}
```

Included `ServiceProvider` (which is loaded using package discovery) automatically makes all these variables available to all views.

Adding variables to share
-------------------------

[](#adding-variables-to-share)

You can add more variables to the sharing pot by using `Share::set()` method from within your `AppServiceProvider`

```
// App\Providers\AppServiceProvider

use SSD\CookiesDialog\Utilities\Share;

public function boot(): void
{
    Share::set('googleTagID', config('services.google.tag_id'));
}
```

Usage
-----

[](#usage)

Within view file

```
@if($thirdPartyCookies)
    // your scripts go here
@endif
```

Js store
--------

[](#js-store)

### `Pinia` store with `InertiaJs`

[](#pinia-store-with-inertiajs)

```
import { defineStore } from 'pinia';
import { usePage } from '@inertiajs/inertia-vue3';

export const useCookieStore = defineStore('cookies', {
  state: () => ({
    visible: usePage().props.value.showCookiesDialog,
    thirdParty: usePage().props.value.thirdPartyCookies,
  }),
  actions: {
    toggle() {
      this.thirdParty = !this.thirdParty;
    },
    agree() {
      axios.post('/ssd/cookie', { third_party: Number(this.thirdParty) })
        .then(() => window.location.reload())
        .catch(error => console.log(error));
    },
  },
});
```

Make sure that `showCookiesDialog` and `thirdPartyCookies` match your configuration variable names if you've overwritten those.

### VueJs `Dialog` component

[](#vuejs-dialog-component)

```

import Settings from './Settings.vue';
import { useCookieStore } from '@/stores/cookies';
import { Link } from '@inertiajs/inertia-vue3';
import { ref } from 'vue'

const store = useCookieStore();

const revealed = ref(false);

                    Cookies

                        We use cookies to help provide you with the best possible online experience.
                        By using this site, you agree that we may store and access cookies on your device.

                            Cookie policy.

                            Cookie settings
                        .

                    I Agree

```

### VueJs `Settings` component

[](#vuejs-settings-component)

```

  import { useCookieStore } from '@/stores/cookies';

  const store = useCookieStore();

            Functional cookies

          Functional Cookies are enabled by default at all times so that we can save your preferences for cookie settings and ensure site works and delivers best experience.

            Third party cookies

          This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
          Keeping this cookie enabled helps us to improve our website.

      Agree to selected

```

Lastly add the component to the footer of your template, and you're done.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~171 days

Total

2

Last Release

1176d ago

PHP version history (2 changes)v1.0.0PHP ^8.0.2

v1.1.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2211203?v=4)[Sebastian Sulinski](/maintainers/sebastiansulinski)[@sebastiansulinski](https://github.com/sebastiansulinski)

---

Top Contributors

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

---

Tags

laravelcookiescookies-dialog

### Embed Badge

![Health badge](/badges/sebastiansulinski-laravel-cookies-dialog/health.svg)

```
[![Health](https://phpackages.com/badges/sebastiansulinski-laravel-cookies-dialog/health.svg)](https://phpackages.com/packages/sebastiansulinski-laravel-cookies-dialog)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[whitecube/laravel-cookie-consent

Register, configure and ask for cookies consent in a EU-compliant way.

498731.9k2](/packages/whitecube-laravel-cookie-consent)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

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