PHPackages                             amply/amply-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. amply/amply-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

amply/amply-php
===============

PHP SDK for Amply

v0.0.1(5y ago)115MITPHPPHP &gt;=7.0

Since Dec 31Pushed 5y agoCompare

[ Source](https://github.com/sendamply/amply-php)[ Packagist](https://packagist.org/packages/amply/amply-php)[ Docs](http://github.com/sendamply/amply-php)[ RSS](/packages/amply-amply-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Amply
=====

[](#amply)

This is the Amply PHP SDK that integrates with the [v1 API](https://docs.sendamply.com/docs/api/docs/Introduction.md).

**Table of Contents**

- [Install](#install)
- [Quick Start](#quick-start)
- [Methods](#methods)
    - [email](#email)

Install
-------

[](#install)

### Prerequisites

[](#prerequisites)

- PHP 7.0+
- Amply account, [sign up here.](https://sendamply.com/plans)

### Access Token

[](#access-token)

Obtain your access token from the [Amply UI.](https://sendamply.com/home/settings/access_tokens)

### Install Package

[](#install-package)

Add Amply to your composer.json file. If you are not using Composer, we highly recommend it. It's an excellent way to manage dependencies in your PHP application.

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

```

Alternative: Install from repo
------------------------------

[](#alternative-install-from-repo)

If you are not using Composer, simply download and checkout the version you want to use from the Github repository.

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

```

### Domain Verification

[](#domain-verification)

Add domains you want to send `from` via the [Verified Domains](https://sendamply.com/home/settings/verified_domains) tab on your dashboard.

Any emails you attempt to send from an unverified domain will be rejected. Once verified, Amply immediately starts warming up your domain and IP reputation. This warmup process will take approximately one week before maximal deliverability has been reached.

Quick Start
-----------

[](#quick-start)

The following is the minimum needed code to send a simple email. Use this example, and modify the `to` and `from` variables:

```
// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)
// require 'vendor/autoload.php';

// Uncomment the next line if you're not using a dependency loader (such as Composer), replacing  with the path to the amply-php.php file
// require_once '/amply-php.php';

$amply = new Amply(getenv('AMPLY_ACCESS_TOKEN'));

try {
    $amply->email->create(array(
        'to' => 'test@example.com',
        'from' => 'test@verifieddomain.com',
        'subject' => 'My first Amply email!',
        'text' => 'This is easy',
        'html' => 'and fun :)'
    ));
}
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);
}
```

Once you execute this code, you should have an email in the inbox of the recipient. You can check the status of your email in the UI from the [Search](https://sendamply.com/home/analytics/searches/basic/new), [SQL](https://sendamply.com/home/analytics/searches/sql/new), or [Users](https://sendamply.com/home/analytics/users) page.

Methods
-------

[](#methods)

### email

[](#email)

Parameter(s)Descriptionto, cc, bccEmail address of the recipient(s). This may be a string `"Test "`, an associative array `array('name' => 'Bill', 'email' => 'test@test.com')`, or a sequential array of strings/associative arrays.personalizationsFor fine tuned access, you may override the to, cc, and bcc keys and use advanced personalizations. See the API guide [here](https://docs.sendamply.com/docs/api/Mail-Send.v1.yaml/paths/~1email/post).fromEmail address of the sender. This may be formatted as a string or associative array with name and email keys. An array of senders is not allowed.subjectSubject of the message.htmlHTML portion of the message.textText portion of the message.contentA sequential array of associative arrays containing the following fields: `type` (required), `value` (required).templateThe template to use. This may be a string (the UUID of the template), a sequential array of UUID strings (useful for A/B/... testing where one is randomly selected), or an associative array of the format `array('template1Uuid' => 0.25, 'template2Uuid' => 0.75)` (useful for weighted A/B/... testing).dynamicTemplateDataThe dynamic data to be replaced in your template. This is an associative array of the format `array('variable1' => 'replacement1', ...)`. Variables should be defined in your template body as `${variable1}`.replyToEmail address of who should receive replies. This may be a string or an associative array with `name` (optional) and `email` fields.headersAn associative array where the header name is the key and header value is the value.ipOrPoolUuidThe UUID string of the IP address or IP pool you want to send from. Default is your Global pool.unsubscribeGroupUuidThe UUID string of the unsubscribe group you want to associate with this email.attachments\[\]An array of attachments containting an associative array with fields `content`, `filename`, `type`, `disposition`, and`contentId`.ttachments\[\]\[content\]A base64 encoded string of your attachment's content (required, string).attachments\[\]\[type\]The MIME type of your attachment (optional, string).attachments\[\]\[filename\]The filename of your attachment (required, string).attachments\[\]\[disposition\]The disposition of your attachment (`inline` or `attachment`) (optional, string).attachments\[\]\[contentId\]The content ID of your attachment (optional, string).clicktrackingEnable or disable clicktracking (bool).categoriesA sequential array of email category strings you can associate with your message.substitutionsAn associative array of the format `array('subFrom' => 'subTo', ...}` of substitutions.**Example**

```
$amply.email.create(array(
    'to' => "example@test.com",
    'cc' => array('name' => 'Billy', 'email' => 'Smith'),
    'from' => 'From ',
    'text' => 'Text part',
    'html' => 'HTML part',
    'content' => array(
        array(
            'type' => 'text/testing',
            'value' => 'Test!',
        ),
    ),
    'subject' => 'A new email!',
    'replyTo' => 'Reply To ',
    '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')
));
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1963d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b95d40b3dafd065000650fdfee0eca1fe8af9d124f9498de79b9405ba8d747cd?d=identicon)[amply](/maintainers/amply)

---

Top Contributors

[![paulwhite](https://avatars.githubusercontent.com/u/738044?v=4)](https://github.com/paulwhite "paulwhite (2 commits)")

---

Tags

amplyemailphptransactional-emailemailsendtransactional emailamplysendamply

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/amply-amply-php/health.svg)

```
[![Health](https://phpackages.com/badges/amply-amply-php/health.svg)](https://phpackages.com/packages/amply-amply-php)
```

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[sendgrid/sendgrid

This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.

1.5k47.5M164](/packages/sendgrid-sendgrid)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94944.1M110](/packages/pelago-emogrifier)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[sendgrid/smtpapi

Build SendGrid X-SMTPAPI headers in PHP.

696.5M2](/packages/sendgrid-smtpapi)[slm/mail

Integration of various email service providers in the Laminas\\Mail

108732.4k1](/packages/slm-mail)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
