PHPackages                             iubenda/iubenda-cookie-class - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. iubenda/iubenda-cookie-class

ActiveProject[Utility &amp; Helpers](/categories/utility)

iubenda/iubenda-cookie-class
============================

PHP class for the cookie law solution

v4.1.16(1y ago)9126.0k↓47%4MITPHPPHP &gt;=5.2.4

Since Sep 25Pushed 1y ago22 watchersCompare

[ Source](https://github.com/iubenda/iubenda-cookie-class)[ Packagist](https://packagist.org/packages/iubenda/iubenda-cookie-class)[ Docs](https://github.com/iubenda/iubenda-cookie-class)[ RSS](/packages/iubenda-iubenda-cookie-class/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)DependenciesVersions (30)Used By (0)

Read Me
=======

[](#read-me)

***PHP class for the iubenda cookie law solution***

If you have European users you need to obtain and manage consent for the use of most cookies. The iubenda Cookie Solution is an all-in-one approach developed by iubenda, that helps to make your website GDPR and Cookie Law compliant by integrating with your cookie policy, providing a compliant cookie banner and the blocking management of cookie scripts. The Cookie Solution also allows users to set advertising preferences on-site and within the solution, facilitated the recent-but-widely adopted IAB Europe Transparency &amp; Consent [framework](https://www.iubenda.com/en/help/7440#aboutIAB).

[Read more about the Cookie Solution here](https://www.iubenda.com/en/features#cookie-solution).

---

#### This class allows you to scan a page in PHP for scripts and run the automatic blocking of scripts

[](#this-class-allows-you-to-scan-a-page-in-php-for-scripts-and-run-the-automatic-blocking-of-scripts)

*This is the class on which our WordPress and Joomla! and Drupal plugins are based and you can use it to build your own plugin independently for a platform other than those for which we have already developed a dedicated solution.*

---

Functionality
-------------

[](#functionality)

This class works with the iubenda Cookie Law Solution and allows you to block the most common widgets and third-party cookies to comply with Cookie Law.

The class is currently able to detect and automatically block the following scripts:

- Google Analytics
- Google Maps
- Google AdSense
- Google ReCaptcha
- Google Site Search
- Google Tag Manager
- Google oAuth
- Google+ widgets
- Twitter widgets
- Facebook widgets
- Facebook Comments
- YouTube
- Vimeo
- Linkedin widgets
- ShareThis widgets
- Instagram widgets
- AddThis widgets
- Pinterest widgets
- PayPal widgets
- Disqus
- Optimizely
- Neodata
- Criteo
- Outbrain
- Headway
- Codepen
- Freshchat
- Uservoice
- AdRoll
- Olark
- Segment
- Kissmetrics
- Mixpanel
- Pingdom
- Bing
- Elevio

It also allows the manual blocking of all other resources without direct intervention on the actual scripts. Read more about the [prior blocking functionality here](https://www.iubenda.com/en/help/1229-cookie-law-solution-preventing-code-execution-that-could-install-cookies).

---

Here is an example of the PHP class integration:

```
function iubenda_system( $html, $type = 'page' ) {
	if ( empty( $html ) )
		return;

	require_once( 'iubenda.class.php' );

	// separator
	if ( ! iubendaParser::consent_given() && ! iubendaParser::bot_detected() ) {
		$iubenda = new iubendaParser( $html, array( 'type' => in_array( $type, array( 'page', 'faster' ), true ) ? $type : 'page' ) );
		$html = $iubenda->parse();
	}

	// finished
	return $html;
}
```

The `iubenda_system` method verifies if the page visitor consents to the use of cookies. If they have consented, the script returns the HTML provided as a parameter without taking any action such as parsing/replacing. Simply copy your method into the PHP document and then call it with the following syntax `iubenda_system("contenutohtml");` that will return the code.

- Parsing/replacing the portions of code contained within `` and ``
- Automatic parsing/replacing of iframe that contain defined src
- Automatic parsing/replacing of scripts that contain defined src

These operations take place in accordance with the rules explained in [this guide](https://www.iubenda.com/en/help/posts/1229). We suggest that you consult the posts relating to the alteration of script, img and iframe tags.

Additional Help and docs
------------------------

[](#additional-help-and-docs)

- [Full Cookie Solution Documentation](https://www.iubenda.com/en/help/1205-technical-documentation-for-the-cookie-law-solution-banner-cookie-policy-and-consent-management)
- [Prior Blocking Guide](https://www.iubenda.com/en/help/1229-cookie-law-solution-preventing-code-execution-that-could-install-cookies)
- [Cookie Solution Feature Overview](https://www.iubenda.com/en/features#cookie-solution)

Changelog
---------

[](#changelog)

##### 4.1.16

[](#4116)

- Tweak: Assign connect.facebook.com to Targeting &amp; Advertising category.

##### 4.1.15

[](#4115)

- Support PHP 8.2 | Fix Creation of dynamic properties

##### 4.1.14

[](#4114)

- Bugfix: escape if custom scripts/iframes are empty

##### 4.1.13

[](#4113)

- Update PHP Simple HTML DOM Parser library to the latest version 1.9.1
- Remove deprecated (Faster/Page) classes

##### 4.1.12

[](#4112)

- Remove GTM from Basic interaction in Iframes

##### 4.1.11

[](#4111)

- Support PHP 8

##### 4.1.10

[](#4110)

- Move [www.googletagmanager.com/gtag/js](http://www.googletagmanager.com/gtag/js) under analytics #4

##### 4.1.9

[](#419)

- Fix SSRF security vulnerability
- Remove googletagmanager.com/gtm.js from basic interaction

##### ``4.1.8

[](#418)

- Fix: Avoid overriding the purposes attr if it was set

##### 4.1.7

[](#417)

- Fix: purpose evaluation for iframes blocking

##### 4.1.6

[](#416)

- Fix: Check script type before getting content in GTM

##### 4.1.5

[](#415)

- Tweak: Add google analytics to analytics scripts
- Tweak: Add data-iub-purposes on inline-scripts

##### 4.1.4

[](#414)

- Fix: Move FB connect to experience enhancement

##### 4.1.3

[](#413)

- Tweak: Add Google GPT to per-purpose blocking support

##### 4.1.2

[](#412)

- Security Fix: limit url sanitize to http protocols

##### 4.1.1

[](#411)

- Fix: AddThis per-purpose category

##### 4.1.0

[](#410)

- New: Google AMP support

##### 4.0.0

[](#400)

- New: Per-purpose script blocking support
- New: Reject button support

##### 3.4.0

[](#340)

- New: Introducing wildcard support for scripts and iframes

##### 3.3.1

[](#331)

- Tweak: Improved Google Tag Manager script blocking

##### 3.3.0

[](#330)

- Tweak: Simple HTML Dom PHP class update to 1.9

##### 3.2.0

[](#320)

- New: Introducing a way to skip specific script parsing

##### 3.1.2

[](#312)

- Tweak: Improved Youtube and Google Maps support

##### 3.1.1

[](#311)

- Tweak: Update composer.json autoloader

##### 3.1.0

[](#310)

- Tweak: Update and extend the list of blocked scripts including Google Site Search, Google oAuth, Linkedin widgets, PayPal widgets, Pinterest, AddThis, Disqus, Optimizely, Neodata, Criteo, Outbrain, Headway, Codepen, Freshchat, Uservoice , AdRoll, Olark, Segment, Kissmetrics, Mixpanel, Pingdom, Bing and Elevio

##### 3.0.0

[](#300)

- Tweak: Update and unify iubenda parsing engine

### License

[](#license)

This project is licensed under the GPl 3 license.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~102 days

Recently: every ~178 days

Total

23

Last Release

594d ago

Major Versions

3.4.0 → 4.0.02019-12-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13381764?v=4)[iubenda](/maintainers/iubenda)[@iubenda](https://github.com/iubenda)

---

Top Contributors

[![bartoszarendt](https://avatars.githubusercontent.com/u/1039132?v=4)](https://github.com/bartoszarendt "bartoszarendt (27 commits)")[![bafi](https://avatars.githubusercontent.com/u/3964752?v=4)](https://github.com/bafi "bafi (22 commits)")[![Facens](https://avatars.githubusercontent.com/u/745978?v=4)](https://github.com/Facens "Facens (14 commits)")[![abbieclement](https://avatars.githubusercontent.com/u/40836347?v=4)](https://github.com/abbieclement "abbieclement (2 commits)")[![danielmarzini](https://avatars.githubusercontent.com/u/44803752?v=4)](https://github.com/danielmarzini "danielmarzini (1 commits)")[![misterwolf](https://avatars.githubusercontent.com/u/811714?v=4)](https://github.com/misterwolf "misterwolf (1 commits)")[![robywan](https://avatars.githubusercontent.com/u/415699?v=4)](https://github.com/robywan "robywan (1 commits)")[![s2imon](https://avatars.githubusercontent.com/u/1027012?v=4)](https://github.com/s2imon "s2imon (1 commits)")

---

Tags

cookiegdpr

### Embed Badge

![Health badge](/badges/iubenda-iubenda-cookie-class/health.svg)

```
[![Health](https://phpackages.com/badges/iubenda-iubenda-cookie-class/health.svg)](https://phpackages.com/packages/iubenda-iubenda-cookie-class)
```

###  Alternatives

[statikbe/laravel-cookie-consent

Cookie consent modal for EU

219426.2k](/packages/statikbe-laravel-cookie-consent)[codingfreaks/cf-cookiemanager

Manage cookies, scripts, and GDPR compliance on your Typo3 website with CodingFreaks Typo3 Cookie Manager. Customize cookie banners, streamline workflow, and enhance user experience. Ensure GDPR compliance and take control of cookie management with our Typo3 cookie management extension. Visit the official Typo3 Documentation page to learn more.

1830.7k](/packages/codingfreaks-cf-cookiemanager)[albertborsos/yii2-gdpr-cookie-consent

GDPR compatible Cookie Consent widget allows the user to choose which kind of cookies they want to accept.

1124.5k1](/packages/albertborsos-yii2-gdpr-cookie-consent)[bramdeleeuw/cookieconsent

GDPR compliant cookie bar and consent checker

1511.7k2](/packages/bramdeleeuw-cookieconsent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
