PHP code example of amply / amply-php

1. Go to this page and download the library: Download amply/amply-php 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/ */

    

amply / amply-php example snippets


// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)
// <PATH TO> with the path to the amply-php.php file
// verifieddomain.com',
        'subject' => 'My first Amply email!',
        'text' => 'This is easy',
        'html' => '<strong>and fun :)</strong>'
    ));
}
catch (\Amply\Exceptions\APIException $e) {
    echo "Generic API error\n";
    echo "$e->code\n";
    echo "$e->text\n";
}
catch (\Amply\Exceptions\ValidationException $e) {
    echo "Invalid input\n";
    print_r($e->errors);
}
catch (\Amply\Exceptions\ResourceNotFoundException $e) {
    echo "Missing resource\n";
    print_r($e->errors);
}

$amply.email.create(array(
    'to' => "[email protected]",
    'cc' => array('name' => 'Billy', 'email' => 'Smith'),
    'from' => 'From <[email protected]>',
    'text' => 'Text part',
    'html' => 'HTML part',
    'content' => array(
        array(
            'type' => 'text/testing',
            'value' => 'Test!',
        ),
    ),
    'subject' => 'A new email!',
    'replyTo' => 'Reply To <[email protected]>',
    'template' => 'faecb75b-371e-4062-89d5-372b8ff0effd',
    'dynamicTemplateData' => array('name' => 'Jimmy'),
    'unsubscribeGroupUuid' => '5ac48b43-6e7e-4c51-817d-f81ea0a09816',
    'ipOrPoolUuid' => '2e378fc9-3e23-4853-bccb-2990fda83ca9',
    'attachments' => array(
        array(
            'content' => 'dGVzdA==',
            'filename' => 'test.txt',
        ),
    ),
    'headers' => array('X-Testing' => 'Test'),
    'categories' => array('Test'),
    'clicktracking' => true,
    'substitutions' => array('sub1' => 'replacement1')
));

{
  ""amply/amply-php": "*"
  }
}

git clone https://github.com/sendamply/amply-php.git
git checkout VERSION