Download the PHP package atriametal/sylius-cookie-consent-plugin without Composer

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

Sylius Cookie Consent Plugin

CI Sylius

Asks the visitors of a Sylius shop for their consent to cookies, purpose by purpose, blocks the scripts and the embedded contents until they consent, and keeps a proof of each choice. It follows the recommendations of the French data protection authority (CNIL):

No external service, no build step: one module script and one style sheet, themable with CSS custom properties.

Requirements

Installation

  1. Require the plugin:

  2. If you do not use Symfony Flex, enable the plugin:

  3. Import the routes. The shop route is outside the locale prefix; the admin route goes under the admin prefix:

  4. Install the assets and create the table of the consent records:

  5. Describe your cookies (see Configuration), block your scripts and embedded contents (see Blocking), and add the preferences link to your footer:

  6. Remove the consent records older than the retention period every day, for instance with cron:

The banner, the style sheet and the script are rendered by the layout template events (Sylius 1) or Twig hooks (Sylius 2) of the shop: a theme that keeps them needs nothing else.

Template Sylius 1 template event Sylius 2 hook
shop/stylesheets.html.twig sylius.shop.layout.stylesheets sylius_shop.base#stylesheets
shop/banner.html.twig sylius.shop.layout.before_body sylius_shop.base.header
shop/javascripts.html.twig sylius.shop.layout.javascripts sylius_shop.base#javascripts

Configuration

The label and the description of each category are translated from atriametal_cookie_consent.categories.<name>.label and .description, in the messages domain. The plugin translates the default categories in English, French and German. Override any text in your translations/messages.<locale>.yaml: the texts of the banner must describe the purposes you actually use.

Blocking scripts and embedded contents

A script runs once a visitor consents to any of the categories listed in its data-cookie-consent attribute. Give it the text/plain type, so that the browser does not run it before:

A module script keeps its type in data-type="module".

An embedded content gets its address from data-src. Until the visitor consents, a placeholder explains why it is hidden and lets the visitor allow its category; data-cookie-consent-service names the third party in it:

On the server side, cookie_consent_granted('media') tells whether the visitor consented. Do not use it in pages cached for every visitor.

Google consent mode

With google_consent_mode.enabled, the style sheet template denies the configured signals before any Google tag loads, and the script sends the choice of the visitor with gtag('consent', 'update', …). Render the style sheet template before your Google tags in the <head>. The consent mode does not replace the blocking: without consent, Google tags still send cookieless pings.

JavaScript

Any element with data-cookie-consent-action="open" opens the preferences. A script cannot be unloaded: when the visitor withdraws a consent, the page is loaded again, after the cookies of the category are deleted.

Theming

Override the custom properties of .cookie-consent and .cookie-consent-placeholder:

See public/cookie-consent.css for the full list. Keep accepting and rejecting with the same style.

Proof of consent

Each choice is recorded with a random identifier, the version of the policy, the granted categories, the date and the channel: no IP address, no customer. The identifier stays the same when the visitor changes the choice, and is shown in the preferences, so that the visitor can refer to it. The admin lists the records under Configuration › Cookie consents.

Limitations

Development

License

MIT


All versions of sylius-cookie-consent-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
doctrine/dbal Version ^3.3 || ^4.0
doctrine/migrations Version ^3.5
doctrine/orm Version ^2.14 || ^3.0
knplabs/knp-menu Version ^3.1
sylius/sylius Version ^1.14 || ^2.0
symfony/config Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
symfony/console Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
symfony/dependency-injection Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
symfony/http-foundation Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
symfony/http-kernel Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
symfony/routing Version ^5.4.21 || ^6.4 || ^7.4 || ^8.0
twig/twig Version ^3.3
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 atriametal/sylius-cookie-consent-plugin contains the following files

Loading the files please wait ...