maxemail/api-php

Maxemail API Client

5.1.1 2021-09-10 13:50 UTC

This package is auto-updated.

Last update: 2024-12-19 17:00:57 UTC


README

Code Checks Codecov Latest Stable Version Total Downloads Licence

Self-contained client in PHP for simplifying access to the Maxemail API

Requirements

PHP

This package requires at least PHP 7.1 . Please see previous releases if you require compatibility with an older version of PHP.

Composer will verify any other environment requirements on install/update.

When creating a new major version of this package, we MAY drop support for PHP versions which are no longer actively supported by the PHP project.

Installation

Including this package in your application is made easy by using Composer.

$ composer require maxemail/api-php

Usage Example

// Instantiate Client:
$config = [
    'username' => 'api@user.com',
    'password' => 'apipass'
];
$api = new \Maxemail\Api\Client($config);

// General:
$result = $api->serviceName->method($arg1, $arg2);
var_dump($result);

Logging

If you want more useful development-time debug info, throw the API a PSR-compatible logger:

$logger = new Logger(); // Must implement \Psr\Log\LoggerInterface
$api->setLogger($logger);

For a quick-start to logging (plus advanced multi-destination logging!), see Phlib/Logger

Helpers

The client also includes a Helper class to take care of common scenarios that are more complicated than the simple request-response model.

The helper is accessed from the client by the getHelper() method:

$api->getHelper()->downloadFile(...);

See the in-line documentation for helper methods for the required and optional parameters.

License

This package is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.