Download the PHP package shawnmccool/minimal-php-postmark-sdk without Composer
On this page you can find all versions of the php package shawnmccool/minimal-php-postmark-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shawnmccool/minimal-php-postmark-sdk
More information about shawnmccool/minimal-php-postmark-sdk
Files in shawnmccool/minimal-php-postmark-sdk
Package minimal-php-postmark-sdk
Short Description A minimal PHP Postmark SDK that enables you to send single and batched email through the PostmarkApp.com service.
License MIT
Informations about the package minimal-php-postmark-sdk
Minimal PHP Postmark SDK
A minimal PHP Postmark SDK that enables you to send single and batched email through the PostmarkApp.com service.
- Design
- Install
- Creating Mailings
- Simple Mail
- Tags and Metadata
- File Attachments
- Postmark Templates
- Named Parameters
- Sending Mailings
- The Postmark API
- Single Mailing
- Batch Mailing
- Development
- Running the Tests
- The Virtual Machine
Design
To maintain reliability, some objects are used for data (such as email and metadata) so that they can ensure that either the data conforms to specification or the developer is made aware of it as quickly as possible.
Install
Creating Mailings
The Mailing class represents a single instance that will be sent to a single recipient.
Simple Mail
To, from, subject, and body.
Tags and Metadata
Configure message tags and metadata for link each mailing to entities, events, etc.
File Attachments
Multiple files can be attached.
Postmark Templates
Instead of specifying a subject line and html body you can use the Postmark template feature. Build the template in the Postmark user interface and specify either its id or alias in the mailing.
or
Postmark templates allow for variables. Create a template model to fill those variables.
Named Parameters
There's a number of options when creating a mailing. It could be possible to make a more rich and complex object model to reduce the need for optional constructor arguments. But in the name of simplicity and the fact that the class is feature complete we're going to leave it how it is.
If you don't like the empty arguments you can create a wrapper class, or you might prefer to use named parameters.
Sending Mailings
The Postmark API
You'll need a server token from postmark.
The PostmarkApi
class handles interactions with the Postmark API.
Single Mailing
Sending a single mail is different from sending a batch. The response is an instance of SuccessResponse
or ErrorResponse
.
Batch Mailing
A batched mailing is an array of mailings that will be sent to the Postmark api in chunks. This prevents new connections to the api being made for each and every mailing. By default the batch mailing will send chunks of 500 mailings at once; but this can be configured.
Development
Development can be done on any machine running at least PHP 8.0. Set up the machine yourself or use the virtual-machine provided.
Running the Tests
The idea here is to test everything that doesn't have side effects against the Postmark API.
The Virtual Machine
The virtual machine may help if you don't have PHP 8.0 on your computer or if you want to avoid some kind of versioning collision etc. This will create an emulated server inside your computer that is configured for development of this package.
For the most part this should not be necessary.
Install modern versions of the following on your computer.
Run the following in the repository's directory.
The virtual machine will initialize. Afterwards enter the virtual machine and run the tests to validate the setup.
All versions of minimal-php-postmark-sdk with dependencies
ext-curl Version *