Download the PHP package mangopay/php-sdk-v2 without Composer
On this page you can find all versions of the php package mangopay/php-sdk-v2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-sdk-v2
MANGOPAY PHP SDK
MangopaySDK is a PHP client library to work with Mangopay REST API.
Compatibility Notes
- Since v2.1 of this SDK, you must be using at least v2.01 of the API (more information about the changes required)
- If you experience problems with authentification and/or the temporary token file following an SDK update (particularly updating to v2.0 of the SDK), you may need to just delete your temporary file (that you specify with
$api->Config->TemporaryFolder
) - which allows it to be regenerated correctly the next time it's needed
Requirements
To use this SDK, you will need (as a minimum):
- PHP 5.6 or newer
- cURL (included and enabled in a standard PHP distribution)
- OpenSSL (included and enabled in a standard PHP distribution)
- psr/log v1.0
- You do not have to use Composer, but you are strongly advised to (particularly for handling the dependency on the PSR Log library)
Installation with Composer
You can use Mangopay SDK library as a dependency in your project with Composer (which is the preferred technique). Follow these installation instructions if you do not already have Composer installed. A composer.json file is available in the repository and it has been referenced from Packagist.
The installation with Composer is easy and reliable:
Step 1 - Add the Mangopay SDK as a dependency by executing the following command:
you@yourhost:/path/to/your-project$ composer require mangopay/php-sdk-v2
Step 2 - Update your dependencies with Composer
you@yourhost:/path/to/your-project$ composer update
Step 3 - Finally, be sure to include the autoloader in your project
require_once '/path/to/your-project/vendor/autoload.php';
The Library has been added into your dependencies and is ready to be used.
Installation without Composer
The project attempts to comply with PSR-4 specification for autoloading classes from file paths. As a namespace prefix is MangoPay\
with base directory /path/to/your-project/
.
If you're not using PSR-4 or Composer, the installation is as easy as downloading the library and storing it under any location that will be available for including in your project (don't forget to include the required library dependencies though):
Alternatively you can download the package in its entirety (ie with all required dependencies) from the Releases page (look for the mangopay2-php-sdk-[RELEASE_NAME].zip
file).
Uncompress the zip file you download, and include the autoloader in your project:
License
MangopaySDK is distributed under MIT license, see the LICENSE file.
Unit Tests
Tests are placed under /path/to/your-project/tests/
.
The /tests/suites/all.php
suite runs ALL tests.
You can also use any of /tests/cases/*.php
to run a single test case.
Contacts
Report bugs or suggest features using issue tracker on GitHub.
Account creation
You can get yourself a free sandbox account or sign up for a production account by registering on the Mangopay site (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).
Configuration
Using the credential info from the signup process above, you should then set $api->Config->ClientId
to your Mangopay ClientId and $api->Config->ClientPassword
to your Mangopay APIKey.
You also need to set a folder path in $api->Config->TemporaryFolder
that SDK needs
to store temporary files. This path should be outside your www folder.
It could be /tmp/
or /var/tmp/
or any other location that PHP can write to.
You must use different folders for your sandbox and production environments.
$api->Config->BaseUrl
is set to sandbox environment by default. To enable production
environment, set it to https://api.mangopay.com
.
Sample usage
Sample usage with Composer in a Symfony project
You can integrate Mangopay features in a Service in your Symfony project.
MangoPayService.php :
Logging
MangoPay uses the PSR3 LoggerInterface. You can provide your own logger to the API. Here is a sample showing Monolog integration :
Verifying rate limits status
According to API docs (https://docs.mangopay.com/guide/rate-limiting), MangoPay is providing a way of verifying how many API calls were made, how many are left and when the counter will be reset. So there are 4 groups of rate limits available:
- Last 15 minutes:
- Last 30 minutes
- Last 60 minutes
- Last 24 hours
This information is available from the MangoPayApi instance, like in the following example:
All versions of php-sdk-v2 with dependencies
ext-curl Version *
ext-openssl Version *
psr/log Version ^1.0|^2.0|^3.0
ext-json Version *