netglue/zf2-domain-parser

ZF2 Module wrapper around Jeremy Kendall's PHP Domain Parser Utility

1.0.0 2014-05-21 13:57 UTC

README

This module simply wraps up the utilities in jeremykendall/php-domain-parser and provides access to them via the service manager along with a controller to update the Public Suffix List.

Install

Install with composer "netglue/zf2-domain-parser" : "1.0.*" and add to your modules with the name 'NetglueDomainParser'

Configure

There's only one config option which is the directory location of the downloaded and prepared public suffix list files.

return array(
    netglueDomainParser' => array(
        'publicSuffixListDirectory' => 'path/to/where/you/want/them/kept',
    ),
);

Services

  • 'Pdp\PublicSuffixListManager' - Access the list manager that's been configured with your specific cache directory.
  • 'Pdp\Parser' - Access the parser instance that's been initialized with the list retrieved from the list manager

Interfaces/Initializers

There's an initializer setup in main service config 'NetglueDomainParser\Factory\ParserInitializer' that will provide the parser instance to anything that implements the interface NetglueDomainParser\ParserAwareInterface.

Console Commands

There's one action available that will download and process the latest list and could easily be triggered by cron once a week/month or something.

$ php public/index.php updatePublicSuffixList

Docs

Refer to jeremykendall/php-domain-parser for instructions on how to use the parser once you've got an instance of it.

Contributing

Contributions, issues, pull-requests are welcome.

TODO

There are currently no tests. I saw little point in this as this module is just a collection of factories really, but perhaps some tests would be helpful...