PHP code example of kubuslab / mpdn-api

1. Go to this page and download the library: Download kubuslab/mpdn-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kubuslab / mpdn-api example snippets


use MPDN;
$globalKey = 'example-global-key-123456789';
MPDN::prepare($globalKey, false);

use MPDN;
$globalKey = 'example-global-key-123456789';
$configGuzzle = [
    'timeout' => 60,
    'verify' => true,
];

MPDN::prepare($globalKey, false, $configGuzzle);

/**
 * File CustomHttpClient.php
 */
use MPDN\Http\ClientInterface;

class CustomHttpClient implements ClientInterface {

    /**
     * Override fungsi sendRequest
     */
    public function sendRequest($method, string $url, $params, array $headers = []) {
        // ...
        // terapkan logic Http Client library anda disini
        // ...
    }
}

use MPDN;
use \CustomHttpClient;

$globalKey = 'example-global-key-123456789';

// Custom Http Client
$myClient = new CustomHttpClient();

MPDN::prepare($globalKey, false)
    ->setHttpClient($myClient);