PHP code example of cbowofrivia / dmarc-record-builder

1. Go to this page and download the library: Download cbowofrivia/dmarc-record-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cbowofrivia / dmarc-record-builder example snippets


$record = new DmarcRecord();

$record->policy('none')
    ->subdomainPolicy('none')
    ->pct(100)
    ->rua('mailto:[email protected]')
    ->ruf('mailto:[email protected]')
    ->adkim('relaxed')
    ->aspf('relaxed')
    ->reporting('any')
    ->interval(604800);

$record = (string) $record;
// v=DMARC1; p=none; sp=none; pct=100; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1; adkim=r; aspf=r; ri=604800;

$record = new DmarcRecord(
    version: 'DMARC1'
    policy: 'none'
    subdomain_policy: 'none'
    pct: 100
    rua: 'mailto:[email protected]'
    ruf: 'mailto:[email protected]'
    adkim: 'relaxed'
    aspf: 'relaxed' 
    reporting: 'any'
    interval: 604800
);

$record = (string) $record;
// v=DMARC1; p=none; sp=none; pct=100; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1; adkim=r; aspf=r; ri=604800;
bash
docker-compose run --rm php composer install && \
docker-compose run --rm php composer test