PHPackages                             nicolasbringas/iab-consent - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. nicolasbringas/iab-consent

Abandoned → [dynata/iabtcf](/?search=dynata%2Fiabtcf)Library[Parsing &amp; Serialization](/categories/parsing)

nicolasbringas/iab-consent
==========================

PHP IAB Consent String Parsing Library

1.0.0(7y ago)24.9k1[2 issues](https://github.com/NicolasBringas/iab-consent/issues)[1 PRs](https://github.com/NicolasBringas/iab-consent/pulls)MITPHPCI passing

Since Apr 4Pushed 3w ago1 watchersCompare

[ Source](https://github.com/NicolasBringas/iab-consent)[ Packagist](https://packagist.org/packages/nicolasbringas/iab-consent)[ RSS](/packages/nicolasbringas-iab-consent/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

This Project is Abandoned
=========================

[](#this-project-is-abandoned)

Please refer to this project for an updated version supporting both v1.1 and v2.

PHP Support for GDPR
====================

[](#php-support-for-gdpr)

This project includes a PHP Library for working with the IAB's [GDPR Transparency &amp; Consent Framework](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/Consent%20string%20and%20vendor%20list%20formats%20v1.1%20Final.md).

Installation with composer
--------------------------

[](#installation-with-composer)

```
composer require nicolasbringas/iab-consent

```

Usage
-----

[](#usage)

### Decode a Consent String

[](#decode-a-consent-string)

```
$cs = new IABConsent\ConsentString("BOQ6ZEAOQ6ZEAABACDENAOwAAAAHCADAACAAQAAQ");

echo "Created Timestamp: " . $cs->getCreated()->getTimestamp() . "\n";
echo "Updated Timestamp: " . $cs->getLastUpdated()->getTimestamp() . "\n";
echo "Version: " . $cs->getVersion() . "\n";
echo "CMP Id: " . $cs->getCmpId() . "\n";
echo "CMP Version: " . $cs->getCmpVersion() . "\n";
echo "Consent Screen: " . $cs->getConsentScreen() . "\n";
echo "Consent Language: " . $cs->getConsentLanguage() . "\n";
echo "Vendor List Version: " . $cs->getVendorListVersion() . "\n";
echo "Allowed Purposes: " . implode(", ", $cs->getPurposesAllowed()) . "\n";
echo "Allowed Vendors: " . implode(", ", $cs->getVendorsAllowed()) . "\n";
echo "Purpose 1 is " . (($cs->isPurposeAllowed(1)) ? "Allowed" : "Not Allowed") . "\n";
echo "Purpose 3 is " . (($cs->isPurposeAllowed(3)) ? "Allowed" : "Not Allowed") . "\n";
echo "Vendor 1 is " . (($cs->isPurposeAllowed(1)) ? "Allowed" : "Not Allowed") . "\n";
echo "Vendor 3 is " . (($cs->isPurposeAllowed(3)) ? "Allowed" : "Not Allowed") . "\n";

```

### Outputs

[](#outputs)

```
Created Timestamp: 1531612800
Updated Timestamp: 1531612800
Version: 1
CMP Id: 1
CMP Version: 2
Consent Screen: 3
Consent Language: en
Vendor List Version: 14
Allowed Purposes: 1, 2
Allowed Vendors: 1, 2, 4
Purpose 1 is Allowed
Purpose 3 is Not Allowed
Vendor 1 is Allowed
Vendor 3 is Not Allowed

```

### Encode consent data

[](#encode-consent-data)

```
$cs = new IABConsent\ConsentString();

// Set the global vendor list
// You need to download and provide the vendor list yourself
// It can be found here - https://vendorlist.consensu.org/vendorlist.json
$cs->setGlobalVendorList($vendorList);

// Set the consent data
$cs->setCmpId(1);
$cs->setCmpVersion(1);
$cs->setConsentScreen(1);
$cs->setConsentLanguage('en');
$cs->setPurposesAllowed([1,2,4]);
$cs->setVendorsAllowed([1,24,245]);

// Encode the data into a web-safe base64 string
echo "Consent String: " . $cs->getConsentString() . "\n";

```

###  Health Score

37

↑

LowBetter than 83% of packages

Maintenance42

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

2594d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d756e78c9d2b968978a57ce30aec628edffd3c7cedfdd19d22a053c9d4e8e94?d=identicon)[Meridion](/maintainers/Meridion)

---

Top Contributors

[![NicolasBringas](https://avatars.githubusercontent.com/u/33419839?v=4)](https://github.com/NicolasBringas "NicolasBringas (11 commits)")

---

Tags

consentiabconsent string

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nicolasbringas-iab-consent/health.svg)

```
[![Health](https://phpackages.com/badges/nicolasbringas-iab-consent/health.svg)](https://phpackages.com/packages/nicolasbringas-iab-consent)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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