Download the PHP package elleracompany/craft-cookie-consent without Composer

On this page you can find all versions of the php package elleracompany/craft-cookie-consent. 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 craft-cookie-consent

Craft Cookie Consent

Ellera Cookie Consent Plugin

Install the plugin

You can install this plugin from the Plugin Store.

Create hook in your template

To give you full control over where the plugin is rendering the consent template. The cookie banner should be the first thing in the DOM for keyboard and screen-reader users.

You need to add this line right after your start-body-tag in the relevant layout file(s):

{% hook 'after-body-start' %}

Activate the plugin for your site

Navigate to the plugin inside your Control Panel. If you have the correct permissions, it should be visible in the menu.

Go to "Site Settings" and add your cookies and cookie groups (We've added some basic ones for you already).

Toggle the "Activated" lightswitch and you're off!

Customize

Using a custom template

Update the template file under Site Settings to point to your template file. The path is rendered with Craft::$app->view->renderTemplate().

Using custom CSS and/or JS

You can turn off loading of assets in Site Settings if you have your own.

You can look in vendor/elleracompany/craft-cookie-consent/src/resources to see the functionality currently implemented by the plugin.

Check for user consent

You can use this function to manage cookie generation for your scripts

{% if craft.cookieConsent.getConsent('slug') %}

You can use it in SEOmatic by navigating to admin/seomatic/tracking and updating the script template.

Planned features

Example using SEOmatic

You will need to bust the SEOmatic cache in your twig templates (not in the SEOmatic script field)

After that you can update the script field inside SEOmatic to something like this:

Cleaning up old consents

You can use a console command to clear out old consents from the database.

This command has three optional parameters:

Parameter Alternative Default Type Description
-d # --days # 365 Integer Sets number of days to keep records
-s # --sid # null Integer Pass a site ID to only clear consents from that site
-s --handle null String Pass a site handle to only clear consents from that site

note: you can only pass sid or handle - not both. If a site is not specified, consents will be deleted from all sites.

Example: Delete all consents older than 2 years from site with ID 1

The window.ccc object

As of version 1.6.0, a new object window.ccc has been added to the default template.

This object contains key-value pairs of consents and their status.

The object will be created if the default javascript file is loaded, and a form with the ID #elc-cookie-consent-form exists and has the data-show-attribute has the url to the consent show endpoint(/cookie-consent/show)

Acknowledgements

Plugin Icon designed by Trinh Ho from Flaticon


All versions of craft-cookie-consent with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
craftcms/cms Version ^5.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 elleracompany/craft-cookie-consent contains the following files

Loading the files please wait ....