PHPackages                             phpnomad/privacy - 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. [Security](/categories/security)
4. /
5. phpnomad/privacy

ActiveLibrary[Security](/categories/security)

phpnomad/privacy
================

1.0.1(3w ago)03.8k[1 PRs](https://github.com/phpnomad/privacy/pulls)2MITPHPCI passing

Since Apr 8Pushed 3w ago2 watchersCompare

[ Source](https://github.com/phpnomad/privacy)[ Packagist](https://packagist.org/packages/phpnomad/privacy)[ Docs](https://github.com/phpnomad)[ RSS](/packages/phpnomad-privacy/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (8)Used By (2)

phpnomad/privacy
================

[](#phpnomadprivacy)

[![Latest Version](https://camo.githubusercontent.com/d5a6f5d67d3256d03312fcb890084c800e354b9c886031595af03ba0534e6f30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f707269766163792e737667)](https://packagist.org/packages/phpnomad/privacy)[![Total Downloads](https://camo.githubusercontent.com/09d353b438e827c31875989ce673964c7eb99ab722a940e2ad08326ca0354385/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f707269766163792e737667)](https://packagist.org/packages/phpnomad/privacy)[![PHP Version](https://camo.githubusercontent.com/3cd438b822ed999102828c22c5b73c71da3085dfd7017b35de37bc705f85e6d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f707269766163792e737667)](https://packagist.org/packages/phpnomad/privacy)[![License](https://camo.githubusercontent.com/c76cabbe28d3471a68d9ff6297f1dd2592ae13e0b3d33952a340306ef15d52cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f707269766163792e737667)](https://packagist.org/packages/phpnomad/privacy)

`phpnomad/privacy` defines a small contract for answering a single question: can the current request be tracked? Application code that emits analytics, user-identifying events, or logs checks the bound strategy first, so consent policy lives in one place instead of being scattered across every call site.

Installation
------------

[](#installation)

```
composer require phpnomad/privacy
```

Overview
--------

[](#overview)

- Ships a single interface, `TrackingPermissionStrategy`, with one method: `canTrack(): bool`.
- Lets you centralize tracking consent in one replaceable strategy instead of repeating checks across analytics, event, and logging code.
- Stays platform-agnostic. The strategy you bind decides whether consent comes from a DNT header, a cookie banner, login state, or application-specific rules.
- Integration packages such as `phpnomad/wordpress-integration` ship default strategies you can replace by binding your own in an initializer.
- Has no runtime dependencies. It's a contract-only package that sits between your tracking code and whatever policy you choose to enforce.

Usage
-----

[](#usage)

Implement the interface in your application:

```
