protonlabs/php-adblock-parser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

protonlabs/php-adblock-parser

最新稳定版本:1.1.5

Composer 安装命令:

composer create-project protonlabs/php-adblock-parser

包简介

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

README 文档

README

Master Build Status

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

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.:

    $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

统计信息

  • 总下载量: 19.01k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固