carono/php-adblock-parser

PHP parser for Adblock Plus filters

Maintainers

👁 carono

Package info

github.com/carono/php-adblock-parser

Homepage

pkg:composer/carono/php-adblock-parser

Statistics

Installs: 50

Dependents: 0

Suggesters: 0

Stars: 1

v0.1.7 2019-10-20 09:09 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 7594f89c91b7491e7ca0d74e307fa3647d9a59d1

  • Limon Monte <limon.monte.woop@gmail.com>

parseradblock

This package is auto-updated.

Last update: 2026-06-21 01:13:49 UTC


README

👁 Build Status
👁 Scrutinizer Code Quality
👁 Code Coverage

Usage

To learn about Adblock Plus filter syntax check these links:

  1. Get filter rules somewhere: write them manually, read lines from a file downloaded from EasyList, etc.:

    $rules = [
     "||ads.example.com^",
     "@@||ads.example.com/notbanner^$~script",
    ];
  2. Create AdblockRules instance from the rules array:

    use Limonte\AdblockParser;
    
    $adblockParser = new AdblockParser($rules);
    $adblockParser->addRules($anotherRules);
  3. Use this instance to check if an URL should be blocked or not:

    $adblockParser->shouldBlock("http://ads.example.com"); // true
    $adblockParser->shouldBlock("http://non-ads.example.com"); // false

Related projects