PHPackages                             kostantinoabate/complihance - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. kostantinoabate/complihance

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

kostantinoabate/complihance
===========================

Laravel package for cookie consent, policies and consent tracking

v1.0.1(3d ago)00MITPHP ^8.4

Since Jul 3Compare

[ Source](https://github.com/KostantinoAbate/complihance)[ Packagist](https://packagist.org/packages/kostantinoabate/complihance)[ Docs](https://github.com/kostantinoabate/complihance)[ GitHub Sponsors](https://github.com/kostantinoabate)[ RSS](/packages/kostantinoabate-complihance/feed)WikiDiscussions Synced today

READMEChangelog (1)Dependencies (9)Versions (8)Used By (0)

Complihance
===========

[](#complihance)

[![Latest Version on Packagist](https://camo.githubusercontent.com/770e4b53766944bbacb45997b8903ceb4f78b4365458b6689eda2e51684a7476/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f7374616e74696e6f61626174652f636f6d706c6968616e63652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kostantinoabate/complihance)[![Total Downloads](https://camo.githubusercontent.com/67d6a2aad4f2aaecb8441efb58df8f6b69d18e68654c21795df03b7c19e15161/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f7374616e74696e6f61626174652f636f6d706c6968616e63652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kostantinoabate/complihance)[![GitHub Tests Action Status](https://github.com/KostantinoAbate/complihance/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/KostantinoAbate/complihance/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://github.com/KostantinoAbate/complihance/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/KostantinoAbate/complihance/actions/workflows/fix-php-code-style-issues.yml)[![License](https://camo.githubusercontent.com/7660804bd87a3cc5a7108fcfc46a4b1d6b98b98703511223ddf3167904a3cf72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4b6f7374616e74696e6f41626174652f636f6d706c6968616e63652e7376673f7374796c653d666c61742d737175617265)](https://github.com/KostantinoAbate/complihance/blob/main/LICENSE.md)

A Laravel package for cookie consent, policy acceptance, consent persistence, Google Consent Mode, cookie scanning and blocked embedded content.

---

### FULL DOCUMENTATION WILL BE AVAILABLE SOON!

[](#full-documentation-will-be-available-soon)

---

> ✅ Ready-to-use cookie banner
> ✅ Consent preferences page
> ✅ Granular vendor consent
> ✅ Google Consent Mode support
> ✅ Consent audit log and retention
> ✅ Cookie, storage and script scanner

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

[](#installation)

Install the package via Composer:

```
composer require kostantinoabate/complihance
```

Run the install command:

```
php artisan complihance:install
```

Run the migrations:

```
php artisan migrate
```

Publish editable data files:

```
php artisan vendor:publish --tag=complihance-data
```

Setup
-----

[](#setup)

Add the Complihance scripts to your main layout, preferably inside the ``:

```
@complihanceConsentMode
@complihanceScript
```

Render the default banner before the closing `` tag:

```
@complihanceBanner
```

Example:

```

    @complihanceConsentMode
    @complihanceScript

    {{-- Your application --}}

    @complihanceBanner

```

Preferences page
----------------

[](#preferences-page)

To let users update or revoke their consent, render the preferences component in any Blade view:

```
@complihancePreferences
```

Cookie policy table
-------------------

[](#cookie-policy-table)

Render a cookie/technology table:

```
@complihanceCookieTable
```

Render only one category:

```
@complihanceCookieTable('analytics')
```

Configuration
-------------

[](#configuration)

The config file is published to:

```
config/complihance.php
```

Main options:

```
'cookie_name' => 'complihance_consent',

'cookie_lifetime' => 60 * 24 * 365,

'cookie_policy_url' => '/cookie-policy',

'banner' => [
    'enabled' => true,
],

'cookie_configuration_version' => '1.0.0',

'granular_consent' => [
    'enabled' => false,
],

'consent_mode' => [
    'enabled' => true,
],
```

When your cookie configuration changes, increment:

```
'cookie_configuration_version' => '1.0.1',
```

Users will be asked to renew their consent.

Data files
----------

[](#data-files)

Editable data files can be published with:

```
php artisan vendor:publish --tag=complihance-data
```

Published files:

```
resources/vendor/complihance/categories.json
resources/vendor/complihance/technologies.json
resources/vendor/complihance/texts.json
```

Consent categories
------------------

[](#consent-categories)

Default categories are:

- `necessary`
- `analytics`
- `marketing`
- `functional`

Example category:

```
{
    "analytics": {
        "required": false,
        "enabled": true,
        "consent_mode": [
            "analytics_storage"
        ],
        "translations": {
            "en": {
                "label": "Analytics and performance cookies",
                "description": "These cookies allow the collection of information about user behavior."
            }
        }
    }
}
```

Technologies and vendors
------------------------

[](#technologies-and-vendors)

Technologies are configured in `technologies.json`.

Example:

```
{
    "_ga": {
        "category": "analytics",
        "vendor": "Google Analytics",
        "pattern": "^_ga($|_)",
        "translations": {
            "en": {
                "name": "_ga",
                "description": "Used to distinguish users.",
                "duration": "2 years"
            }
        }
    }
}
```

Enable vendor-level consent:

```
'granular_consent' => [
    'enabled' => true,
],
```

Google Consent Mode
-------------------

[](#google-consent-mode)

Google Consent Mode is enabled by default.

```
'consent_mode' => [
    'enabled' => true,
],
```

Complihance renders the default consent state through:

```
@complihanceConsentMode
```

Consent Mode values are updated automatically when the user saves or changes preferences.

Blocking embedded content
-------------------------

[](#blocking-embedded-content)

Complihance can prevent embedded content from loading before consent is granted.

Example:

```
render(category: 'marketing', src: 'https://www.youtube.com/embed/example') !!}
    width="560"
    height="315"
>
```

Or with the Blade directive:

```

```

Frontend API
------------

[](#frontend-api)

Complihance exposes a frontend API on `window.Complihance`.

```
window.Complihance.hasConsent();
window.Complihance.requiresRenewal();

window.Complihance.canUse('analytics');
window.Complihance.canUseVendor('google_analytics');

window.Complihance.acceptAll();
window.Complihance.rejectAll();
window.Complihance.revoke();

window.Complihance.onConsentChanged((consent) => {
    // Initialize services after consent changes.
});
```

HTTP API
--------

[](#http-api)

Default API prefix:

```
/complihance/api
```

Available endpoints:

```
GET    /complihance/api/consent
POST   /complihance/api/consent
PATCH  /complihance/api/consent
DELETE /complihance/api/consent
GET    /complihance/api/consent/status
GET    /complihance/api/configuration
```

Example payload:

```
{
    "source": "api",
    "categories": ["necessary", "analytics"],
    "vendors": ["google_analytics"]
}
```

Artisan commands
----------------

[](#artisan-commands)

Export collected consents:

```
php artisan complihance:export-consents
```

Export consents for a date range:

```
php artisan complihance:export-consents --from=2026-01-01 --to=2026-12-31
```

Apply retention rules:

```
php artisan complihance:retention
```

Preview retention without changing data:

```
php artisan complihance:retention --dry-run
```

Scan cookies, storage and scripts:

```
php artisan complihance:scan-cookies https://example.com
```

Scan only HTTP `Set-Cookie` headers:

```
php artisan complihance:scan-cookies https://example.com --http-header-only
```

Scan a sitemap:

```
php artisan complihance:scan-cookies https://example.com/sitemap.xml --sitemap
```

Export a scan report:

```
php artisan complihance:scan-cookies https://example.com --report=json
```

Compare two scans:

```
php artisan complihance:scan-diff
```

Reset local Complihance data:

```
php artisan complihance:reset --force
```

Cookie scanner requirements
---------------------------

[](#cookie-scanner-requirements)

Browser-based scanning requires Playwright and Chromium:

```
npm install -D playwright
npx playwright install chromium
```

In Docker/Linux environments, Chromium system dependencies may also be required.

Alternatively, use the HTTP-only scanner:

```
php artisan complihance:scan-cookies https://example.com --http-header-only
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance99

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cee8a9b960e3da3ce65b35156f3124c059a57a014ddb4ee2bff999d6255ef952?d=identicon)[kostantinoabate](/maintainers/kostantinoabate)

---

Tags

laravelkostantinoabatecomplihance

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kostantinoabate-complihance/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

472890.7k40](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24857.5k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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