Download the PHP package quebecstudio-mods/laravel-consent-kit without Composer

On this page you can find all versions of the php package quebecstudio-mods/laravel-consent-kit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-consent-kit

Cookie Consent for Laravel — quebecstudio-mods/laravel-consent-kit

Cookie consent banner for Laravel 11 to 13, built for Quebec's Law 25 and usable under the GDPR. Built on quebecstudio-mods/consent-kit-core, shared with the Craft CMS plugin.

Installation

Requires PHP 8.2. Declare the private repositories in the application's composer.json:

The service provider is discovered automatically. The banner is added to every HTML page served through the web middleware group.

How it works

InjectConsent, appended to the web group, edits HTML responses:

Position Markup
first in <head> the inline bootstrap: reads the consent cookie, primes Matomo and Google Consent Mode in a refused state
end of <head> consent.css
end of <body> the <qsm-consent-kit> banner (when autoInject is on) and consent.js

JSON, redirects, file and streamed responses are left untouched.

Configuration

config/cookie-consent.php. The keys follow the core's settings; the Craft-only ones (policySource, policyEntry, templateRoot) do not apply.

Key Default What it does
cookieName cookie_consent Cookie that stores the decision
cookieMaxAge 15552000 Its lifetime, in seconds
version 1 Increase to ask every visitor again
policyUrl /privacy-policy Policy link in the banner; empty shows none
defaultLanguage en Language when the locale has no wording file
autoInject true Adds the banner to every HTML page the middleware sees
colorScheme auto auto, light, dark
backdropStyle blur blur, dim, none
displayMode full full, floating, corner-left, corner-right; full width under 40rem
reopenButton true Tab that reopens the banner
reopenPosition auto Its side: left, right, or auto, right for corner-right
gpcHidesBanner true Skips the banner under Global Privacy Control
analyticsCategory statistics Category granting Matomo and analytics_storage
marketingCategory marketing Category granting the Google ad signals
videoFacade true YouTube videos load on click
videoThumbnails true The facade shows the YouTube thumbnail
videoConsentCategory '' Category whose consent skips the facade
inventoryFramework '' Cookie table classes: '', bootstrap, bulma, tailwind, custom
inventoryClasses [] Classes per table element, with custom
categories null Categories and cookies; null uses the shipped ones

Categories

null ships three categories: necessary, declaring the session cookie (config('session.cookie')), XSRF-TOKEN and the consent cookie; statistics and marketing, empty. A category with no declared cookie is not shown.

Wording in categories is a string, or keyed by locale:

Wording

The banner speaks the application locale (app()->getLocale()): the exact locale, then its base language, then defaultLanguage.

lang/vendor/cookie-consent/<language>.php replaces strings or adds a language. A file holds only the keys it changes:

copies the shipped files there as a starting point. A published file keeps every key, so shipped wording updates no longer reach it; keep only the keys you change.

In templates

@withCookieTable outputs its content as HTML with the [cookie-table] markers replaced; like {!! !!}, use it only for HTML you trust. CookieConsent::withCookieTable() escapes content that is not Htmlable.

Method Returns
banner() the banner, once per request
cookieTable(options) the declared cookies; options classes, category, heading, headingLevel
withCookieTable(content, options) content with its [cookie-table] markers replaced; content that is not Htmlable is escaped
videoFacade(id, title, poster) a YouTube facade
categories() visible categories and their cookies
config() the resolved configuration

YouTube posters are served by the route cookie-consent.thumbnail (/cookie-consent/thumbnail?v=<id>), outside the web group, and cached in storage/app/cookie-consent-thumbnails/.

Overriding templates

resources/views/vendor/cookie-consent/<name>.blade.php replaces a shipped template: banner, cookie-table, video-facade, video-embed.

The variables each template receives are listed in the core package's README. Keep the data-qsm-ck-* attributes: the script finds every control through them.

Assets

vendor:publish --tag=cookie-consent-assets copies consent.js and consent.css to public/vendor/cookie-consent/. They are also published with the laravel-assets tag, which the Laravel application skeleton republishes on composer update.

Front end

Styling, the JavaScript API, conditional tags and integration recipes are the same as for the Craft plugin; see its documentation.

Recording consents

The package does not keep a register of decisions, but everything needed to build one is there: an event, a beacon script, and the server-side fingerprint of what the banner was showing. Recording consents walks through it.

Tests

Licence

Proprietary. See LICENSE.md.


All versions of laravel-consent-kit with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/http Version ^11.0 || ^12.0 || ^13.0
illuminate/routing Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0
illuminate/view Version ^11.0 || ^12.0 || ^13.0
quebecstudio-mods/consent-kit-core Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package quebecstudio-mods/laravel-consent-kit contains the following files

Loading the files please wait ...