maxemail / api-php
Maxemail API Client
Installs: 10 101
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 6
Forks: 1
Open Issues: 0
Requires
- php: ^7.1|^8
- ext-fileinfo: *
- ext-json: *
- ext-zip: *
- guzzlehttp/guzzle: ^6 || ^7
- psr/log: ^1.0
Requires (Dev)
- phlib/logger: ^3|^4
- php-mock/php-mock-phpunit: ^2.0
- phpunit/phpunit: ^7|^8|^9
- symplify/easy-coding-standard: ^9
Suggests
- psr/log-implementation: A logger can be used to provide debug information
README
Self-contained client in PHP for simplifying access to the Maxemail API
Requirements
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/.