Download the PHP package freshmail/php-api-client without Composer
On this page you can find all versions of the php package freshmail/php-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download freshmail/php-api-client
More information about freshmail/php-api-client
Files in freshmail/php-api-client
Package php-api-client
Short Description FreshMail API PHP Client
License Apache-2.0
Informations about the package php-api-client
PHP API Client for Freshmail API V3
This API V3 client covers only sending transactional emails by FreshMail Application. If You want to use any other functions of API use API V2 client.
Requirements
- PHP7.2 and above
Installation
Update your composer.json and run composer update
or execute
Usage
Sent transactional email
Handle with response object
Handle with raw PSR-7 ResponseInterface
Send personalized email
Send multiply emails
You can send multiple emails by one request. It's much faster than sending one email by one request. In one request You can send up to 100 emails.
Send email from template
You can use FreshMail Templates mechanism to optimize requests to API. Additionally You can modify content of Your emails in FreshMail, not modifying the code of Your application.
Send email with attachments
You can sent emails with attachments. You can upload up to 10 files. Weight of all attachments in email can't exceed 10Mb.
Error handling
API throws exceptions for errors that occurred during requests and errors occurred before sending requests.
- If request is not sent to server because of wrong API usage, a
FreshMail\Api\Client\Exception\ApiUsageException
is thrown. This kind of exception means, for example, wrong parameters pass to some methods or passing both content and template in transactional mail, which means request won't be accepted, so API does not make any request. - If request is sent and some network issue occurred (DNS error, connection timeout, firewall blocking requests), a
FreshMail\Api\Client\Exception\RequestException
is thrown. - If request is sent, a response is received but some server error occurred (500 level http code), a
FreshMail\Api\Client\Exception\ServerException
is thrown. - If request is sent, a response is received but some client error occurred (400 level http code), a
FreshMail\Api\Client\Exception\ClientError
is thrown. This error message hasgetRequest
andgetResponse
methods to receive raw Request nad Response object (implemented by PSR-7Psr\Http\Message\RequestInterface
andPsr\Http\Message\ResponseInterface
)
FreshMail\Api\Client\Exception\RequestException
, FreshMail\Api\Client\Exception\ClientException
and FreshMail\Api\Client\Exception\ServerException
extends from FreshMail\Api\Client\Exception\TransferException
.
FreshMail\Api\Client\Exception\TransferException
and FreshMail\Api\Client\Exception\ApiUsageException
extends from FreshMail\Api\Client\Exception\GeneralApiException
. All exceptions has methods hasRequest
, hasResponse
.
Proxy setup
If You need to configure proxy You can use a custom GuzzleHttp\Client
object.
Logging and debugging
If You need to log or debug Your request You can use 2 features.
PSR-3 Logger Interface
You can use any library that implements PSR-3 Psr\Log\LoggerInterface
, example with Monolog below:
Logging by GuzzleHttp Client
To make request API use GuzzleHttp\Client
object. If You want You can configure it in any way You want, especially You can enable logging in Client.
All versions of php-api-client with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^6.3 || ^7.4
monolog/monolog Version ^1.24|^2.0|^3.0
psr/log Version ^1.1|^2.0|^3.0
psr/http-message Version ^1.0|^2.0
myclabs/php-enum Version ^1.7