faysalce / leadbook-mail-sdk-prod
This library allows you to quickly and easily send emails through LeadbookMail using PHP.
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: >=5.6.19 <7.3
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.0
- php-http/message: ^1.0
Requires (Dev)
- fabpot/php-cs-fixer: ^1.11
- mockery/mockery: ^0.9.4
- php-http/guzzle6-adapter: ^1.0
This package is auto-updated.
Last update: 2020-09-22 12:32:19 UTC
README
Before using this library, you must have a valid API Key. To get an API Key, please log in to your LeadbookMail account and generate one in the Settings page.
Installation
The recommended way to install the LeadbookMail PHP Library is through composer.
# Install Composer
curl -sS https://getcomposer.org/installer | php
LeadbookMail requires php-http client (see Setting up a Request Adapter). There are several providers available. If you were using guzzle6 your install might look like this.
composer require guzzlehttp/guzzle
composer require php-http/guzzle6-adapter
Next, run the Composer command to install the LeadbookMail PHP Library:
composer require faysalce/leadbook-mail
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php'; use LeadbookMail\LeadbookMail;
Setting up a Request Adapter
Because of dependency collision, we have opted to use a request adapter rather than requiring a request library. This means that your application will need to pass in a request adapter to the constructor of the LeadbookMail Library. We use the HTTPlug in LeadbookMail. Please visit their repo for a list of supported clients and adapters. If you don't currently use a request library, you will need to require one and create a client from it and pass it along. The example below uses the GuzzleHttp Client Library.
An Client can be setup like so:
<?php require 'vendor/autoload.php'; use LeadbookMail\LeadbookMail; use GuzzleHttp\Client; use Http\Adapter\Guzzle6\Client as GuzzleAdapter; $httpClient = new GuzzleAdapter(new Client()); $sparky = new LeadbookMail($httpClient, ['key'=>'YOUR_API_KEY']); ?>