GithubHelp home page GithubHelp logo

php-dmarc's Introduction

php-dmarc - A simple DMARC report parser for PHP

php-dmarc is a small PHP class I wrote to parse DMARC aggregate reports and put the data in a MySQL database for easy analysis. The idea is that when recipients start supporting delivery of reports using HTTP, then this can form part of an endpoint that receives and automatically parses the reports.

Improvements/fixes welcome.

Installation

The library is available on Packagist (solaris/php-dmarc) and can be installed using Composer. Alternatively you can grab the code directly from GitHub and include the DmarcAggregateParser.php script directly or via a PSR-0 autoloader.

Usage

  • Set up your database. tables.sql contains the SQL needed to set up the tables.

  • Use the Solaris\DmarcAggregateParser class to parse reports - you need to supply it with database credentials, and then run the parse() function with an array of files to parse. Something like this:

      $parser = new Solaris\DmarcAggregateParser( 'dbhost', 'dbuser', 'dbpass', 'dbname' );
      $parser->parse( array( 'report-file-1.xml', 'report-file-2.xml', 'report-file-3.xml' ) );
    

    You can supply either XML files or ZIP files. It is assumed that each ZIP file contains only one report.

  • Knock your self out analysing the data.

The parse() function returns false if it encounters any errors while parsing the data (true otherwise). To see what the errors were, use the get_errors() method, which will return an array of error messages.

To do

Once recipients start supporting them:

  • Failure report parser
  • An endpoint for receiving reports using HTTP

php-dmarc's People

Contributors

solarissmoke avatar naugrimm avatar

Watchers

TekOps, Inc. avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.