PHPackages                             zeroad.network/token - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. zeroad.network/token

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

zeroad.network/token
====================

An HTTP-header-based "access / entitlement token" library for Zero Ad Network partnering sites using PHP

0.14.0(4mo ago)027Apache-2.0PHPPHP ^7.2 || ^8.0CI passing

Since Dec 30Pushed 4mo agoCompare

[ Source](https://github.com/laurynas-karvelis/zeroad-token-php)[ Packagist](https://packagist.org/packages/zeroad.network/token)[ Docs](http://zeroad.network)[ RSS](/packages/zeroadnetwork-token/feed)WikiDiscussions main Synced 1mo ago

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

zeroad.network/token (PHP)
==========================

[](#zeroadnetworktoken-php)

The official PHP module for integrating websites with the [Zero Ad Network](https://zeroad.network) platform.

What is Zero Ad Network?
------------------------

[](#what-is-zero-ad-network)

Zero Ad Network is a browser-based platform that creates a better web experience for both users and content creators:

**For Users:**

- Browse without ads, trackers, cookie consent dialogs, and marketing pop-ups
- Access paywalled content across multiple sites with a single subscription
- Support content creators directly through fair revenue distribution

**For Publishers:**

- Generate revenue from users who would otherwise use ad blockers
- Provide a cleaner user experience while maintaining income
- Get paid based on actual user engagement with your content

**How It Works:**

1. Users subscribe and install the Zero Ad Network browser extension
2. The extension sends cryptographically signed tokens to partner sites
3. Partner sites verify tokens and enable premium features (ad-free, paywall-free)
4. Monthly revenue is distributed to publishers based on user engagement time

Features
--------

[](#features)

This module provides:

- ✅ **Zero dependencies** - Lightweight and secure (only requires ext-sodium)
- ✅ **Cryptographic verification** - ED25519 signature validation using ext-sodium
- ✅ **Performance optimized** - Built-in APCu caching for 10-20x performance boost
- ✅ **PHP 7.2+ compatible** - Works with legacy and modern PHP versions
- ✅ **Easy integration** - Simple API with minimal configuration

Runtime Compatibility
---------------------

[](#runtime-compatibility)

RuntimeVersionReadyPHP 77.2+✅PHP 88.0+✅**Required:**

- `ext-sodium` (included by default in PHP 7.2+)

**Recommended:**

- `ext-apcu` (for caching - provides 10-20x performance improvement)

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

[](#installation)

```
composer require zeroad.network/token
```

### Optional: Install APCu for Caching

[](#optional-install-apcu-for-caching)

**Highly recommended** for production environments:

```
# Debian/Ubuntu
sudo apt-get install php-apcu

# CentOS/RHEL
sudo yum install php-pecl-apcu

# Enable in php.ini
extension=apcu.so
apc.enabled=1
apc.shm_size=32M
```

Quick Start
-----------

[](#quick-start)

### 1. Register Your Site

[](#1-register-your-site)

Before implementing, you need to:

1. [Sign up](https://zeroad.network/login) for a Zero Ad Network account
2. [Register your site](https://zeroad.network/publisher/sites/add) to receive your unique `Client ID`

### 2. Choose Your Features

[](#2-choose-your-features)

Decide which features your site will support:

- **`Constants::FEATURE['CLEAN_WEB']`**: Remove ads, cookie consent screens, trackers, and marketing dialogs
- **`Constants::FEATURE['ONE_PASS']`**: Provide free access to paywalled content and base subscription plans

### 3. Basic Implementation

[](#3-basic-implementation)

```
