2017 © Pedro Peláez
 

library client-php

Herald client for PHP

image

herald-project/client-php

Herald client for PHP

  • Thursday, April 26, 2018
  • by joostfaassen
  • Repository
  • 3 Watchers
  • 2 Stars
  • 761 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 30 Versions
  • 6 % Grown

The README.md

Herald PHP client

Send beautiful messages from your application., (*1)

Installation

composer require herald-project/client-php

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

You can use the bin/herald-client CLI application to run commands against your herald server., (*2)

The application needs a couple of configuration directives to work:, (*3)

  • 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. https://herald.dev) 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:, (*4)

Individual options:

For example:, (*5)

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

A single DSN

For example:, (*6)

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

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, (*7)

By .env

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

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

This way you also don't need to pass any options for each command, (*9)

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

The Versions

26/04 2018

dev-master

9999999-dev

Herald client for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

email messages mandrill smtp templates mailgun herald

26/04 2018

v2.7.1

2.7.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

email messages mandrill smtp templates mailgun herald

26/04 2018

v2.7.0

2.7.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

email messages mandrill smtp templates mailgun herald

09/03 2018

v2.6.0

2.6.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

email messages mandrill smtp templates mailgun herald

27/02 2018

v2.5.0

2.5.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

email messages mandrill smtp templates mailgun herald

25/01 2018

v2.4.0

2.4.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

29/08 2017

v2.3.2

2.3.2.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

13/04 2017

v2.3.1

2.3.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

07/08 2016

v2.3.0

2.3.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

06/08 2016

v2.2.0

2.2.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

07/07 2016

v2.1.0

2.1.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

12/03 2016

v2.0.1

2.0.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

11/03 2016

v2.0.0

2.0.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

20/11 2015

v1.3.1

1.3.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

20/11 2015

v1.3.0

1.3.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

19/11 2015

v1.2.0

1.2.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

15/06 2015

v1.1.2

1.1.2.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

04/06 2015

v1.1.1

1.1.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

19/05 2015

v1.1.0

1.1.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

18/05 2015

v1.0.10

1.0.10.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

18/05 2015

v1.0.9

1.0.9.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

11/05 2015

v1.0.8

1.0.8.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

10/05 2015

v1.0.7

1.0.7.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

28/04 2015

v1.0.6

1.0.6.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

08/04 2015

v1.0.5

1.0.5.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

07/04 2015

v1.0.4

1.0.4.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

07/04 2015

v1.0.3

1.0.3.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

27/03 2015

v1.0.2

1.0.2.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

20/03 2015

v1.0

1.0.0.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald

20/03 2015

v1.0.1

1.0.1.0

Herald client for PHP

  Sources   Download

MIT

The Requires

 

email messages mandrill smtp templates mailgun herald