Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Consent Bundle Laravel Package

elao/consent-bundle

View on GitHub
Deep Wiki
Context7

Consent Bundle

This bundle provides a "cookies toast" allowing you to require user consent before using tracking scripts or cookies.

Blue

Green

Green

Installation

composer require elao/consent-bundle

In your bundles.php files:

return [
+    Elao\Bundle\ConsentBundle\ElaoConsentBundle::class => ['all' => true],
];

Configuration

By default, the bundle provide a single consent type called default.

You can replace this default consent by one or multiple custom consent:

elao_consent:
    consents:
        foobar:
            label: Consent to foobar
        barfoo:
            label: Consent to barfoo

You can also configure the cookie containing user consent:

elao_consents:
    cookie:
        name: "consent"
        ttl: 15552000 # 6 months

Usage

In Twig with default consents:

{% if has_user_consent() %}
    <script>
        // your script requiring consent here
    </script>
{% endif %}

With multiple consents:

{% if has_user_consent('foobar') %}
    <script>
        // your script requiring consent here
    </script>
{% endif %}
{% if has_user_consent('barfoo') %}
    <script>
        // your script requiring consent here
    </script>
{% endif %}

Overriding colors

In your CSS:

.elao-consent {
    --elao-consent-primary: #007bff;
    --elao-consent-primary-dark: #256cdf;
    --elao-consent-secondary: #dfebfa;
    --elao-consent-secondary-dark: #cadef8;
    --elao-consent-danger: #ef4055;
    --elao-consent-neutral: #eae8e8;
    --elao-consent-light: #fff;
    --elao-consent-dark: #252525;
}

SASS example:

.elao-consent {
    $elao-consent-base-color: #FFCA29;
  
    --elao-consent-primary: #{$elao-consent-base-color};
    --elao-consent-primary-dark: #{darken($elao-consent-base-color, 1%)};
    --elao-consent-secondary: #{lighten($elao-consent-base-color, 50%)};
    --elao-consent-secondary-dark: #{darken(lighten($elao-consent-base-color, 50%), 1%)};
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware