cbowofrivia/dmarc-record-builder

A lean package that makes creating DMARC records user friendly

Installs: 113 839

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/cbowofrivia/dmarc-record-builder


README

Latest Version on Packagist Tests Total Downloads

Installation

You can install the package via composer:

composer require cbowofrivia/dmarc-record-builder

Usage

$record = new DmarcRecord();

$record->policy('none')
    ->subdomainPolicy('none')
    ->pct(100)
    ->rua('mailto:example@example.com')
    ->ruf('mailto:example@example.com')
    ->adkim('relaxed')
    ->aspf('relaxed')
    ->reporting('any')
    ->interval(604800);

$record = (string) $record;
// v=DMARC1; p=none; sp=none; pct=100; rua=mailto:example@example.com; ruf=mailto:example@example.com; fo=1; adkim=r; aspf=r; ri=604800;

You can also build the record in the constructor

$record = new DmarcRecord(
    version: 'DMARC1',
    policy: 'none',
    subdomain_policy: 'none',
    pct: 100,
    rua: 'mailto:example@example.com',
    ruf: 'mailto:example@example.com',
    adkim: 'relaxed',
    aspf: 'relaxed',
    reporting: 'any',
    interval: 604800
);

$record = (string) $record;
// v=DMARC1; p=none; sp=none; pct=100; rua=mailto:example@example.com; ruf=mailto:example@example.com; fo=1; adkim=r; aspf=r; ri=604800;

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.