Overview
The Configuration class holds all configuration settings for connecting to and interacting with the Mangopay API.
Properties
ClientId
Your Mangopay client ID (also called API client username).
$config->ClientId = 'your-client-id';
ClientPassword
Your Mangopay API key (also called client password).
$config->ClientPassword = 'your-api-key';
BaseUrl
BaseUrl
string
default:"https://api.sandbox.mangopay.com"
Base URL to the Mangopay API. Use https://api.sandbox.mangopay.com for sandbox environment and https://api.mangopay.com for production.
// Sandbox environment
$config->BaseUrl = 'https://api.sandbox.mangopay.com';
// Production environment
$config->BaseUrl = 'https://api.mangopay.com';
TemporaryFolder
TemporaryFolder
string|null
default:"null"
Path to folder for temporary files. The folder must have write permissions. Used for storing temporary data during API operations.
$config->TemporaryFolder = '/tmp/';
CertificatesFilePath
Absolute path to file containing one or more certificates to verify the peer with. If empty, peer certificate verification is disabled.
$config->CertificatesFilePath = '/path/to/cacert.pem';
DebugMode
Enable debug mode to log all request and response data. For internal usage only.
$config->DebugMode = true;
LogClass
LogClass
string
default:"MangoPay\\\\Libraries\\\\Logs"
The logging class to use when DebugMode is enabled.
$config->LogClass = 'MangoPay\\Libraries\\Logs';
CurlConnectionTimeout
cURL connection timeout limit in seconds.
$config->CurlConnectionTimeout = 60;
CurlResponseTimeout
cURL response timeout limit in seconds.
$config->CurlResponseTimeout = 60;
HostProxy
HostProxy
string|null
default:"null"
Proxy host to use for API requests.
$config->HostProxy = 'proxy.example.com:8080';
UserPasswordProxy
UserPasswordProxy
string|null
default:"null"
Proxy authentication in the format user:password.
$config->UserPasswordProxy = 'username:password';
Set to true for UK traffic. Deprecated: Will be removed in future versions.
$config->UKHeaderFlag = true;
Example Usage
Basic Configuration
use MangoPay\MangoPayApi;
$api = new MangoPayApi();
// Set required credentials
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = '/tmp/';
Production Configuration
use MangoPay\MangoPayApi;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->BaseUrl = 'https://api.mangopay.com';
$api->Config->TemporaryFolder = '/var/tmp/mangopay/';
$api->Config->CertificatesFilePath = '/path/to/cacert.pem';
Configuration with Proxy
use MangoPay\MangoPayApi;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->HostProxy = 'proxy.example.com:8080';
$api->Config->UserPasswordProxy = 'proxyuser:proxypass';
Configuration with Custom Timeouts
use MangoPay\MangoPayApi;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->CurlConnectionTimeout = 60;
$api->Config->CurlResponseTimeout = 90;
Using a Separate Configuration Object
use MangoPay\MangoPayApi;
use MangoPay\Libraries\Configuration;
$config = new Configuration();
$config->ClientId = 'your-client-id';
$config->ClientPassword = 'your-api-key';
$config->BaseUrl = 'https://api.mangopay.com';
$config->TemporaryFolder = '/tmp/';
$api = new MangoPayApi();
$api->setConfig($config);