定制 shakaran/adstxtparser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

shakaran/adstxtparser

最新稳定版本:1.0

Composer 安装命令:

composer require shakaran/adstxtparser

包简介

A open source implemation in PHP of Ads.txt Specification Version 1.0.1 (OpenRTB working group)

README 文档

README

PRs Welcome Build Status Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

A open source implentation in PHP of Ads.txt Specification Version 1.0.1 (OpenRTB working group)

Graph Ads.txt

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:

paypal

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.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2018-06-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固