PHPackages                             apostle/apostle-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. [API Development](/categories/api)
4. /
5. apostle/apostle-php

ActiveLibrary[API Development](/categories/api)

apostle/apostle-php
===================

Apostle PHP Client

v0.1.5(11y ago)1610.3k1[3 issues](https://github.com/apostle/apostle-php/issues)1PHPPHP &gt;=5.3.2

Since Oct 21Pushed 11y ago5 watchersCompare

[ Source](https://github.com/apostle/apostle-php)[ Packagist](https://packagist.org/packages/apostle/apostle-php)[ RSS](/packages/apostle-apostle-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (2)Versions (6)Used By (1)

Apostle PHP
===========

[](#apostle-php)

[![Build Status](https://camo.githubusercontent.com/3535843d6fa4419fcfbb402297982946a19aaf5a85266602f904922776a2e0b4/68747470733a2f2f7472617669732d63692e6f72672f61706f73746c652f61706f73746c652d7068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/apostle/apostle-php)[![Latest Stable Version](https://camo.githubusercontent.com/dac3cd58ae0d87d6478f0c62a84a02050334c321693c0c38262dbe6d038bfeb5/68747470733a2f2f706f7365722e707567782e6f72672f61706f73746c652f61706f73746c652d7068702f762f737461626c652e706e67)](https://packagist.org/packages/apostle/apostle-php)

PHP bindings for [Apostle.io](http://apostle.io)

Installation
------------

[](#installation)

### With Composer

[](#with-composer)

Add `apostle/apostle-php` to `composer.json`.

```
{
    "require": {
        "apostle/apostle-php": "v0.1.5"
    }
}
```

### Without Composer

[](#without-composer)

Download the [latest release](https://github.com/apostle/apostle-php/releases). Ensure `src` is in your autoload path. If you’re not using auto loading, require the following files:

- Apostle.php
- Apostle\\Queue.php
- Apostle\\Mail.php
- Aposlte\\UninitializedException.php

#### Prerequisites

[](#prerequisites)

- [Guzzle](http://docs.guzzlephp.org/en/latest/)

Domain Key
----------

[](#domain-key)

You will need to provide your apostle domain key to send emails.

```
Apostle::setup("your-domain-key");
```

Sending Email
-------------

[](#sending-email)

Sending a single email is easy, the first param is your template's slug, and the second is an array of data.

```
use Apostle\Mail;

$mail = new Mail(
	"template-slug",
	array("email" => "mal@apostle.io", "name" => "Mal Curtis")
);

$mail->deliver();
```

You don‘t have to add the data at initialization time, feel free to add it after. You can add in any data your template needs too.

```
$mail = new Mail("template-slug");
$mail->email = "mal@apostle.io";
$mail->name = "Mal Curtis";
$mail->from = "support@apostle.io";
$mail->replyTo = "doreply@apostle.io";
$mail->website = "apostle.io"; // You can add any data your template needs

$mail->deliver();
```

Attachments can be added by supplying a filename and content as a string.

```
$mail = new Mail("template-slug");
$mail->addAttachment("test.txt", "Some test text");
$mail->deliver();
```

### Failure

[](#failure)

Pass a variable for failure information to the `deliver` method.

```
$mail = new Apostle\Mail("template-slug");

echo $mail->deliver($failure);
// false

echo $failure;
// No email provided
```

Sending Multiple Emails
-----------------------

[](#sending-multiple-emails)

To speed up processing, you can send more than one email at a time.

```
use Apostle\Mail;
use Apostle\Queue;

$queue = new Queue();

for($i=0;$iemail = "user" . $i . "@example.org";
	$queue->add($mail);
}

$queue->deliver();
```

### Failures

[](#failures)

If any `Mail` object fails validation then no emails will be sent. To retrieve failed objects, you can supply a variable to be populated.

```
use Apostle\Mail;
use Apostle\Queue;

$queue = new Queue();

$mail = new Mail("template-slug");
$queue->add($mail);

$mail = new Mail(null, ["email" => "user@example.org"]);
$queue->add($mail);

echo $queue->deliver($failures);
// false

echo count($failures);
// 2

echo $failures[0]->deliveryError();
// "No email provided"

echo $failures[1]->deliveryError();
// "No template provided"
```

Requirements
------------

[](#requirements)

- PHP 5.3+

Who
---

[](#who)

Created with ♥ by [Mal Curtis](http://github.com/snikch) ([@snikchnz](http://twitter.com/snikchnz))

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Every ~114 days

Total

5

Last Release

4128d ago

### Community

Maintainers

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

---

Top Contributors

[![snikch](https://avatars.githubusercontent.com/u/115958?v=4)](https://github.com/snikch "snikch (5 commits)")

---

Tags

apostle

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rackspace/php-opencloud

PHP SDK for Rackspace/OpenStack APIs

4495.9M38](/packages/rackspace-php-opencloud)[cdaguerre/php-trello-api

Trello API v2 client

255666.7k3](/packages/cdaguerre-php-trello-api)[dchesterton/marketo-rest-api

A PHP client for the Marketo.com REST API

41844.1k1](/packages/dchesterton-marketo-rest-api)[carlosio/geckoboard

A PHP library for dealing with Geckoboard API (http://www.geckoboard.com)

40172.2k](/packages/carlosio-geckoboard)[teepluss/api

Laravel 4 Internal Request (HMVC)

7034.0k](/packages/teepluss-api)[jlinn/mandrill-api-php

A PHP client library for Mandrill's REST API

24117.4k](/packages/jlinn-mandrill-api-php)

PHPackages © 2026

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