shakaran/adstxtparser
Composer 安装命令:
composer require shakaran/adstxtparser
包简介
A open source implemation in PHP of Ads.txt Specification Version 1.0.1 (OpenRTB working group)
README 文档
README
A open source implentation in PHP of Ads.txt Specification Version 1.0.1 (OpenRTB working group)
Note: ADS = Authorized Digital Sellers DSP = Demand Side Platforms
WHAT IS ADS.TXT?
Ads.txt is an initiative by the Interactive Advertising Bureau to enable publishers to take control over who can sell their ad inventory.
Since 01 Nov 2017 Google is filtering traffic based on ads.txt
It is a simple logic of the textfile as mechanism to fight adfraud
Widely accepted and implemented by more and more publishers, ssp and dsp.
Can prevent advertisers from buying invalid traffic.
Check more info about it.
Donate
I am a freelancer Senior Backend Engineer working on my free time for develop this.
If you want pay me some beer or severals to appreciate the efforts:
Setup
Install with composer with only:
composer require shakaran/adstxtparser
TECHNICAL NOTES
Requires PHP 7.0+.
How to use
A quick use to instanciate and run over a domain is:
use AdsTxtParser\Parser; $parser = new Parser(); $parser->readExternalFile('http://estaticos.elmundo.es');
Note: that you only have to pass as argument the domain.
After you already fetch the data in the Parser object, you can query about errors:
$errors = $parser->getErrors();
Or warnings:
$warnings = $parser->getWarnings();
Or get the variables defined:
$variables = $parser->getVariables();
Or get the fields defined:
$fields = $parser->getFields();
Or get the comments defined:
$comments = $parser->getComments();
Even more complex operations, as know the list of resellers:
$resellers = $parser->getResellers();
Or the list or directs:
$directs = $parser->getDirects();
A complex example using all the options could be:
try { // By default localhost $parser = new Parser(); $parser->readExternalFile('http://estaticos.elmundo.es'); // More examples to test: // https://elpais.com/ads.txt // https://www.elconfidencial.com/ads.txt } catch(AdsFileNotFound $e) { echo $e->getMessage(); } $comments = $parser->getComments(); // var_dump($comments); $errors = $parser->getErrors(); //var_dump($errors); $warnings = $parser->getWarnings(); // var_dump($warnings); $fields = $parser->getFields(); // var_dump($fields); $variables = $parser->getVariables(); //var_dump($variables); $resellers = $parser->getResellers(); //var_dump(count($resellers)); $directs = $parser->getDirects(); //var_dump(count($directs));
Tests
Executing the tests:
Run a local webserver under Test directory:
cd Tests; sudo php -S localhost:80
vendor/phpunvendor/phpunit/phpunit/phpunit --configuration=Tests/phpunit.xml --include-path=Tests
License
AGPLv3 or later, see LICENSE file for more details.
shakaran/adstxtparser 适用场景与选型建议
shakaran/adstxtparser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 515 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「parser」 「specification」 「ads」 「adstxtparser」 「adstxt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shakaran/adstxtparser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shakaran/adstxtparser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shakaran/adstxtparser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Helper that decorates any SUS with a phpspec lazy object wrapper
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Specification support for Doctrine
An MT940 bank statement parser for PHP
Specifications like JSON schemas and other things for mosparo
Laravel integration for the jsonapi.org parser
统计信息
- 总下载量: 515
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2018-06-13