PHPackages                             protonlabs/php-adblock-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. protonlabs/php-adblock-parser

ActiveProject[Parsing &amp; Serialization](/categories/parsing)

protonlabs/php-adblock-parser
=============================

PHP parser for Adblock Plus filters. A fork of abandoned limonte/php-adblock-parser

1.1.5(3y ago)020.9k↓25%1[1 PRs](https://github.com/ProtonMail/php-adblock-parser/pulls)MITPHPPHP &gt;=8.1

Since Feb 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ProtonMail/php-adblock-parser)[ Packagist](https://packagist.org/packages/protonlabs/php-adblock-parser)[ Docs](https://github.com/limonte/php-adblock-parser)[ RSS](/packages/protonlabs-php-adblock-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

PHP parser for Adblock Plus filters
===================================

[](#php-parser-for-adblock-plus-filters)

[![Master Build Status](https://github.com/ProtonMail/php-adblock-parser/actions/workflows/master.yml/badge.svg)](https://github.com/ProtonMail/php-adblock-parser/actions/workflows/master.yml)

This is a fork of the abandoned Limonte\\AdblockParser.

It has been edited to optimize performance, namely:

- The object containing the rules can be saved to avoid the long time to create it.
- Only run necessary rules; the generic rules and the rules applying specifically to the domain of the url.

It also separates responsibilities of classes better by having factories, services and DTOs.

Usage
-----

[](#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](https://easylist.to/), etc.:

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

    ```
    use Limonte\AdblockParser;

    $ruleAggregate = (new RuleAggregateFactory(new RuleFactory()))->createFromAdblockEntries($adblockEntries);
    ```
3. Use this instance to check if an URL should be blocked or not:

    ```
    (new RuleApplier())->shouldBlock("http://ads.example.com", $ruleAggregate); // true
    (new RuleApplier())->shouldBlock("http://non-ads.example.com", $ruleAggregate); // false
    ```

Related projects
----------------

[](#related-projects)

- Google Safebrowsing PHP library: [limonte/google-safebrowsing](https://github.com/limonte/google-safebrowsing)
- McAfee SiteAdvisor PHP library: [limonte/mcafee-siteadvisor](https://github.com/limonte/mcafee-siteadvisor)
- Check if link is SPAM: [limonte/spam-link-analyser](https://github.com/limonte/spam-link-analyser)

---

- Python parser for Adblock Plus filters: [scrapinghub/adblockparser](https://github.com/scrapinghub/adblockparser/)
- EasyList filter subscription: [easylist/easylist](https://github.com/easylist/easylist/)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 95.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

10

Last Release

1142d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/837170204c2dc6beffb28cfca8ff9036709ac38d5f5f16ab2b8b8a7cb025c089?d=identicon)[BafS](/maintainers/BafS)

---

Top Contributors

[![schreven](https://avatars.githubusercontent.com/u/39119115?v=4)](https://github.com/schreven "schreven (21 commits)")[![j-nolan](https://avatars.githubusercontent.com/u/11057256?v=4)](https://github.com/j-nolan "j-nolan (1 commits)")

---

Tags

parseradblock

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/protonlabs-php-adblock-parser/health.svg)

```
[![Health](https://phpackages.com/badges/protonlabs-php-adblock-parser/health.svg)](https://phpackages.com/packages/protonlabs-php-adblock-parser)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k902.6M1.8k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.0k151.8M732](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k404.0M702](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
