Download the PHP package zeroad.network/token without Composer

On this page you can find all versions of the php package zeroad.network/token. 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 token

zeroad.network/token (PHP)

The official PHP module for integrating websites with the Zero Ad Network platform.

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:

For Publishers:

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

This module provides:

Runtime Compatibility

Runtime Version Ready
PHP 7 7.2+
PHP 8 8.0+

Required:

Recommended:

Installation

Optional: Install APCu for Caching

Highly recommended for production environments:

Quick Start

1. Register Your Site

Before implementing, you need to:

  1. Sign up for a Zero Ad Network account
  2. Register your site to receive your unique Client ID

2. Choose Your Features

Decide which features your site will support:

3. Basic Implementation

4. In Your Templates

Token Context

After parsing, the token context contains boolean flags for each feature:

Important: All flags default to false for:

Performance & Caching

APCu Cache (Highly Recommended)

The module includes built-in APCu caching to dramatically improve performance by avoiding redundant cryptographic operations.

Performance Impact:

Configuration

How Caching Works:

  1. Token header is hashed (xxHash) to create cache key
  2. If cached and not expired, returns immediately (~15μs)
  3. If cache miss, performs crypto verification (~150μs)
  4. Result cached with TTL = min(config TTL, token expiry time)
  5. Expired tokens automatically removed from cache

Cache automatically respects token expiration - even with long cache TTL, expired tokens are never served from cache.

Without APCu

If APCu is not available, the module works normally but performs full crypto verification on every request. Consider:

Performance Benchmarks

Typical performance on modern hardware:

Operation Without Cache With APCu Cache Improvement
Parse token ~150μs ~15μs 10x faster
1000 req/sec 150ms blocking 15ms blocking 90% less CPU

Advanced Configuration

Cache Configuration

Recommended TTL Settings:

Scenario TTL Reason
High traffic (1000+ req/sec) 10-30s Maximize cache hits
Normal traffic (100-1000 req/sec) 5-10s Balance freshness and performance
Low traffic (<100 req/sec) 2-5s Keep data fresh

Logging

Set Log Level:

Custom Log Handler:

Security

Token Verification

All tokens are cryptographically signed using ED25519 by Zero Ad Network:

Token Structure

Each token contains:

  1. Protocol version - Currently v1
  2. Nonce - Random 4-byte value
  3. Expiration timestamp - Unix timestamp
  4. Feature flags - Bitmask of enabled features
  5. Client ID (optional) - For developer tokens
  6. Cryptographic signature - ED25519 signature

Example token:

Privacy

Tokens contain no personally identifiable information:

Framework Examples

Laravel

Symfony

WordPress

Complete Usage Example

Implementation Requirements

When implementing Zero Ad Network features, you must fulfill these requirements to remain in good standing:

CLEAN_WEB Requirements

ONE_PASS Requirements

⚠️ Failure to comply will result in removal from the Zero Ad Network platform.

Troubleshooting

Tokens Not Working

Check APCu Status

Common Issues

  1. All flags are false - Token is expired, invalid, or missing
  2. Performance slow - Install APCu for 10-20x speedup
  3. Token rejected - Verify Client ID matches registered site
  4. Headers not sent - Ensure header() is called before any output

API Reference

Site

Creates a site instance with helper methods.

Constants

Logger

Resources

License

Apache License 2.0 - see LICENSE file for details

About Zero Ad Network

Zero Ad Network is building a fairer internet where:

Join thousands of publishers creating a better web experience.

Get Started →


All versions of token with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
ext-sodium Version *
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 zeroad.network/token contains the following files

Loading the files please wait ...