Configuration

During installation, you'll publish a configuration file for Cookie Notice to config/cookie-notice.php. The contents of said file look like this:

1<?php
2 
3return [
4 
5 /*
6 |--------------------------------------------------------------------------
7 | Cookie
8 |--------------------------------------------------------------------------
9 |
10 | It's ironic, but this addon uses cookies to store if a user has consented
11 | to cookies or not, and which ones they've consented to. Don't worry
12 | though, no cookie is stored if the user doesn't consent.
13 |
14 */
15 
16 'cookie_name' => 'COOKIE_NOTICE',
17 
18 /*
19 |--------------------------------------------------------------------------
20 | Consent Groups
21 |--------------------------------------------------------------------------
22 |
23 | Consent groups allow you to give your users the option to which cookies they'd
24 | like to enable and which cookies they'd prefer to keep disabled.
25 |
26 */
27 
28 'groups' => [
29 'Necessary' => [
30 'required' => true,
31 'toggle_by_default' => true,
32 ],
33 'Statistics' => [
34 'required' => false,
35 'toggle_by_default' => false,
36 ],
37 'Marketing' => [
38 'required' => false,
39 'toggle_by_default' => false,
40 ],
41 ],
42 
43];
  • cookie_name defines the name of the cookie you wish to store the users' cookie preferences.
  • groups is an array of consent groups. Feel free to update them however you want. The key is the name of the group, which will be displayed to the user. required defines whether the user is absolutly required to accept cookies for that group. toggle_by_default will automatically check the checkbox on the consent notice, however the user will be able to uncheck it if they want.