pigeon/pigeon

Pigeon lets you easily manage your outbound email, push notifications and SMS. Visit https://pigeonapp.io for more details.

v0.2.0 2019-03-31 18:22 UTC

This package is not auto-updated.

Last update: 2024-05-13 19:04:32 UTC


README

Pigeon lets you easily manage your outbound email, push notifications and SMS. Visit https://pigeonapp.io for more details.

Installation

The recommended way to install Pigeon is through Composer.

$ composer require pigeon/pigeon

Usage

$pigeon = new Pigeon\Client('PIGEON_PUBLIC_KEY', 'PIGEON_PRIVATE_KEY');

Public (PIGEON_PUBLIC_KEY) and private (PIGEON_PRIVATE_KEY) keys would be retrieved from the env variables if not passed.

Prepare for the delivery

$message_identifier = 'message-identifier';
$parcels = ['to' => 'john@example.com'];
  • Message identifier is used to identify the message. Grab this from your Pigeon dashboard.
  • Parcels array accepts to, cc, bcc and data.

Deliver

$pigeon->deliver($message_identifier, $parcels);

Parcel sample (Single recipient)

$parcels = [
  'to' => 'John Doe <john@example.com>',
  'cc' => [
    'admin@example.com',
    'Sales Team <sales@example.com>'
  ],
  'data' => [
    // template variables are added here
    'name' => 'John'
  ],
  'attachments' => [
    // `file` can be local file path, remote URL or a file pointer resource
    [
      'file' => '/path/to/image.png',
      'name' => 'Logo'
    ],
    [
      'file' => 'https://example.com/guide.pdf',
      'name' => 'Guide'
    ]
  ]
];

Parcel sample (Multiple recipients)

$parcels = [
  [
    'to' => 'John Doe <john@example.com>',
    'data' => [
      // template variables are added here
      'name' => 'John'
    ]
  ],
  [
    'to' => 'Jane Doe <jane@example.com>',
    'data' => [
      // template variables are added here
      'name' => 'Jane'
    ]
  ],
];

Framework integration

Contributing

You can contribute in one of two ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The composer package is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Pigeon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.