2017 © Pedro Peláez
 

library adstxtparser

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

image

shakaran/adstxtparser

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

  • Friday, June 22, 2018
  • by shakaran
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AdsTxtParser

[PRs Welcome][3] Build Status Latest Stable Version Latest Unstable Version License, (*1)

Total Downloads Monthly Downloads Daily Downloads, (*2)

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

Graph Ads.txt, (*4)

Note: ADS = Authorized Digital Sellers DSP = Demand Side Platforms, (*5)

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., (*6)

Since 01 Nov 2017 Google is filtering traffic based on ads.txt, (*7)

It is a simple logic of the textfile as mechanism to fight adfraud, (*8)

Widely accepted and implemented by more and more publishers, ssp and dsp., (*9)

Can prevent advertisers from buying invalid traffic., (*10)

Check more info about it., (*11)

I am a freelancer Senior Backend Engineer working on my free time for develop this., (*12)

If you want pay me some beer or severals to appreciate the efforts:, (*13)

paypal, (*14)

Setup

Install with composer with only:, (*15)

composer require shakaran/adstxtparser

TECHNICAL NOTES

Requires PHP 7.0+., (*16)

How to use

A quick use to instanciate and run over a domain is:, (*17)


use AdsTxtParser\Parser; $parser = new Parser(); $parser->readExternalFile('http://estaticos.elmundo.es');

Note: that you only have to pass as argument the domain., (*18)

After you already fetch the data in the Parser object, you can query about errors:, (*19)

$errors = $parser->getErrors();

Or warnings:, (*20)

$warnings = $parser->getWarnings();

Or get the variables defined:, (*21)

$variables = $parser->getVariables();

Or get the fields defined:, (*22)

$fields = $parser->getFields();

Or get the comments defined:, (*23)

$comments = $parser->getComments();

Even more complex operations, as know the list of resellers:, (*24)

$resellers = $parser->getResellers();

Or the list or directs:, (*25)

$directs = $parser->getDirects();

A complex example using all the options could be:, (*26)

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:, (*27)

Run a local webserver under Test directory:, (*28)

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., (*29)

The Versions

22/06 2018

dev-master

9999999-dev https://shakaran.net/blog

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

  Sources   Download

AGPL-3.0-or-later

The Requires

  • php >=7.0

 

The Development Requires

parser php specification ads adstxtparser adstxt openrtb

14/06 2018

1.0

1.0.0.0

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

  Sources   Download

AGPL-3.0-or-later

The Requires

  • php >=7.0

 

The Development Requires

parser php specification ads adstxtparser adstxt openrtb