PHPackages                             herald-project/client-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. herald-project/client-php

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

herald-project/client-php
=========================

Herald client for PHP

v2.9.2(2mo ago)26.3k↑100%2[1 PRs](https://github.com/linkorb/herald-client-php/pulls)MITPHPPHP &gt;=7.0CI failing

Since Mar 20Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/linkorb/herald-client-php)[ Packagist](https://packagist.org/packages/herald-project/client-php)[ RSS](/packages/herald-project-client-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (36)Used By (0)

Herald PHP client
=================

[](#herald-php-client)

Send beautiful messages from your application.

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

[](#installation)

```
composer require herald-project/client-php

```

Example
-------

[](#example)

```
use Herald\Client\Client as HeraldClient;
use Herald\Client\Message as HeraldMessage;

// get the client with explicit parameters
$herald = new HeraldClient(
    '[herald api username]',
    '[herald api password]',
    '[herald server uri]',
    '[herald transport, e.g. smtp]'),
    '[herald account]',
    '[herald library]',
);

// get the client by DSN

$herald = HeraldClient::fromDsn('https://username:password@herald.dev/myAccount/myLibrary/myTransport');

// check template existance.
if ($herald->templateExists('signup')) {
    // get the message
    $message = new HeraldMessage();
    // use the template
    $message->setTemplate('signup');
    // set to address
    $message->setToAddress($emailAddress, $customerName);
    // populate data
    $message->setData('firstname', 'Hongliang');
    $message->setData('nickname', 'exploder hater');
    // send
    $herald->send($message);
}
```

CLI usage
---------

[](#cli-usage)

You can use the `bin/herald-client` CLI application to run commands against your herald server.

The application needs a couple of configuration directives to work:

- username + password: The account you use to connect. Either a user account, or an API key+secret pair
- apiurl: the base url of herald, (i.e. ) with postfix `/api/v2`
- account + library: This is the library identifier you use to create your templates, layouts and transports

You can pass this data in 3 ways:

### Individual options:

[](#individual-options)

For example:

```
./bin/herald-client --username=x --password=y --apiurl=https://herald.dev/api/v2 --account=test --library=test template:exists welcome

```

### A single DSN

[](#a-single-dsn)

For example:

```
./bin/herald-client --dsn=https://x:y@herald.dev/test/test/mandrill

```

### By environment variables

[](#by-environment-variables)

You can define the environment variable `HERALD_DSN` with a valid URL, this way you don't need to pass any options to the CLI application

### By .env

[](#by-env)

The Herald CLI application loads `.env` before running any commands, allowing you to create a `.env` file like this:

```
HERALD_DSN=https://x:y@herald.dev/test/test/mandrill
```

This way you also don't need to pass any options for each command

### Example commands

[](#example-commands)

```
# get list of all contact lists
bin/herald-client list:list

# get list of contacts in contact list #1
bin/herald-client list:contacts 1

# get list of segments for list #1
bin/herald-client list:segments 1

# get available list_fields for list #1
bin/herald-client list:fields 1

# delete contact #42
#bin/herald-client contact:delete 42

# get properties of contact #6
bin/herald-client contact:properties 6

# add new contact with address 'new.contact@example.com' to list #1
bin/herald-client contact:add 1 new.contact@example.com

# add new property to contact #36 for list field id #4
bin/herald-client property:add 36 4 "some value"

# send message based on template #7 to all contacts in list #1
bin/herald-client list:send 1 7

# send message based on template #1 to contacts in list #1 that meet the conditions for segment #6
bin/herald-client list:send 1 7 6

```

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance84

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~119 days

Recently: every ~321 days

Total

35

Last Release

80d ago

Major Versions

v1.3.1 → v2.0.02016-03-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/1db66b320db18b8036ea68211b7d8a39e7c6da97e6fd29f59a50380ebb69d0bb?d=identicon)[joostfaassen](/maintainers/joostfaassen)

![](https://www.gravatar.com/avatar/1b784da6e9b890f576cd3cac29511978c10afc0e3b9572b498f2841952d953ef?d=identicon)[h-wang](/maintainers/h-wang)

---

Top Contributors

[![joostfaassen](https://avatars.githubusercontent.com/u/411113?v=4)](https://github.com/joostfaassen "joostfaassen (34 commits)")[![h-wang](https://avatars.githubusercontent.com/u/3410322?v=4)](https://github.com/h-wang "h-wang (30 commits)")[![prajapati-kaushik](https://avatars.githubusercontent.com/u/10140681?v=4)](https://github.com/prajapati-kaushik "prajapati-kaushik (6 commits)")[![bvklim](https://avatars.githubusercontent.com/u/5628078?v=4)](https://github.com/bvklim "bvklim (4 commits)")[![mhitza](https://avatars.githubusercontent.com/u/273079?v=4)](https://github.com/mhitza "mhitza (3 commits)")[![boite](https://avatars.githubusercontent.com/u/989892?v=4)](https://github.com/boite "boite (1 commits)")

---

Tags

emailtemplatesmailgunmessagesmandrillsmtpherald

### Embed Badge

![Health badge](/badges/herald-project-client-php/health.svg)

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

###  Alternatives

[slm/mail

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

109745.7k1](/packages/slm-mail)[slot/mandrill-bundle

Symfony Mandrill Bundle

651.5M1](/packages/slot-mandrill-bundle)[omnimail/omnimail

PHP Library to send email across all platforms using one interface.

33235.4k](/packages/omnimail-omnimail)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[swissup/module-email

Magento2 email providers integration (smtp, mandrill, amazon ses)

1413.6k1](/packages/swissup-module-email)

PHPackages © 2026

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