PHP code example of toancong / mdoc

1. Go to this page and download the library: Download toancong/mdoc 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/ */

    

toancong / mdoc example snippets


// obtain api key
$apiKey = env('MDOC_API_KEY')

// instance client
$client = new \Bean\Mdoc\Client($apiKey);

// Returns your detailed user data.
$response = $client->me->get();

// Get all users for account
$response = $client->users->get();

// Get some other paths using magic

// change specific version
$response = $client->coverpages->version('')->get();

// other api path
$response = $client->other->path('fax/history')->get();
$response = $client->other->path('fax/history')->getClient()->requestWithAuth('get', 'v1/fax/history');

// other method
$response = $client->other->getClient()->requestWithAuth('post', 'v1/users', [
    'form_params' => [
        'firstName' => 'John',
        'lastName'  => 'Doe',
        'email'     => '[email protected]',
        'password'  => 'c.ZQdgm3WAka',
    ]
]);

// Send a fax
$response = $client->other->getClient()->requestWithAuth('post', '/v1/faxes', [
    'multipart' => [
        [
            'name'     => 'faxNumber',
            'contents' => '+12456789000',
        ],
        [
            'name'     => 'attachments',
            'contents' => fopen('/path/to/file', 'r'),
        ],
    ]
]);