Download the PHP package klkvsk/clearurls without Composer

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

ClearUrls PHP

High-performance PHP library for removing tracking parameters from URLs using the ClearURLs ruleset.

Features

Installation

Requirements

Using Composer

The package includes pre-compiled rules (src/Rules.php), so it's ready to use immediately after installation.

Quick Start

Usage Examples

Basic URL Cleaning

Handling Redirections

Referral Marketing

By default, referral marketing parameters (like Amazon affiliate tags) are removed. To keep them:

Checking Result Status

Batch Processing

Custom Configuration

If you need custom rules, you can create providers manually:

Performance

The library is optimized for speed:

Run performance benchmarks:

Architecture

Core Components

  1. ClearUrls.php - Main cleaning logic

    • URL parsing and validation
    • Provider matching
    • Rule application
    • URL rebuilding
  2. Provider.php - Rule provider data structure

    • Pattern matching
    • Exception handling
    • Redirection extraction
  3. ClearUrlResult.php - Immutable result object

    • Cleaned URL
    • Modification status
    • Action flags
  4. Rules.php - Auto-generated (205 providers, 734+ rules)
    • Pre-compiled regex patterns
    • Optimized data structure
    • Generated by build script

Build System (For Package Maintainers)

compile-rules.php - Rules compilation script (used by package maintainers to update rules)

How It Works

  1. Build Time (package maintainers only): The build script fetches rules from ClearURLs and compiles them to PHP with pre-compiled regex patterns
  2. Runtime (end users): When cleaning a URL:
    • Finds matching provider by URL pattern
    • Checks exceptions (URLs that should not be processed)
    • Handles redirections (extracts embedded URLs)
    • Applies raw rules (regex on entire URL)
    • Removes matching query parameters and fragments
    • Rebuilds the clean URL

Rules Format

Rules are fetched from the ClearURLs project. Each provider has:

See ClearURLs documentation for details.

Updating Rules (For Package Maintainers)

The pre-compiled rules (src/Rules.php) are included in the package. End users don't need to update them.

For package maintainers: To update rules to the latest version from ClearURLs:

This fetches rules from https://rules2.clearurls.xyz/data.minify.json and regenerates src/Rules.php.

The build script compares the SHA-256 hash of fetched rules against the previous version:

Use the --local flag to skip fetching and compile from cached rules:

Automated Rules Updates (GitHub Actions)

The repository includes a GitHub Actions workflow that automatically:

  1. Fetches the latest ClearURLs rules
  2. Compiles them to optimized PHP code
  3. Creates a new versioned release (format: 1.0.YYYYMMDD)
  4. Updates the CHANGELOG
  5. Pushes to GitHub and creates a git tag for Packagist

To trigger an update:

  1. Go to the repository's "Actions" tab on GitHub
  2. Select "Update ClearURLs Rules" workflow
  3. Click "Run workflow" button
  4. The workflow fetches rules and checks if they changed (via SHA-256 hash)
  5. If rules changed AND version tag doesn't exist โ†’ creates new release
  6. If rules unchanged โ†’ keeps existing version, no duplicate release

Version format: x.y.YYYYMMDD where:

This ensures Packagist automatically picks up new rule updates without manual intervention.

Project Structure

Testing

Install dev dependencies:

Run tests:

Supported Providers (205 total)

Major Providers

Global Rules

API Reference

ClearUrls Class

ClearUrlResult Class

Provider Class

Contributing

Contributions are welcome! Areas for contribution:

Credits

License

MIT License

The rules data is provided by the ClearURLs project and is licensed under LGPL-3.0-or-later.

Links


All versions of clearurls with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
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 klkvsk/clearurls contains the following files

Loading the files please wait ...