PHP code example of devmehq / sdk-php

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

    

devmehq / sdk-php example snippets


use DevmeSdk\Authentication\APIKeyHeaderAuthentication;
use Jane\Component\OpenApiRuntime\Client\Plugin\AuthenticationRegistry;

$authenticationRegistry = new AuthenticationRegistry([new APIKeyHeaderAuthentication('demo-key')]);
$apiClient = \DevmeSdk\Client::create(null, [$authenticationRegistry]);

$apiClient->v1ConvertCurrency(['from' => 'USD', 'to' => 'EUR', 'amount' => 10]);

// {
//   convertedAmount: 8.819,
//   convertedText: '10 USD equal to 8.819 EUR',
//   exchangeRate: 0.8819,
//   from: 'USD',
//   originalAmount: 10,
//   rateTime: '2022-01-20T14:49:28.046Z',
//   to: 'EUR'
// }

use DevmeSdk\Authentication\APIKeyHeaderAuthentication;
use Jane\Component\OpenApiRuntime\Client\Plugin\AuthenticationRegistry;

$authenticationRegistry = new AuthenticationRegistry([new APIKeyHeaderAuthentication('demo-key')]);
$apiClient = \DevmeSdk\Client::create(null, [$authenticationRegistry]);

$apiClient->v1GetIpDetails([ 'ip' => '52.45.23.11']);

// {
//   asn: 14618,
//   aso: 'AMAZON-AES',
//   city: {
//   accuracyRadius: 1000,
//     latitude: 39.0469,
//     longitude: -77.4903,
//     metroCode: 511,
//     name: 'Ashburn',
//     timeZone: 'America/New_York',
//   },
//   countryCode: 'US',
//   ip: '52.45.23.11',
//   registeredCountryCode: 'US',
// }


use DevmeSdk\Authentication\APIKeyHeaderAuthentication;
use Jane\Component\OpenApiRuntime\Client\Plugin\AuthenticationRegistry;

$authenticationRegistry = new AuthenticationRegistry([new APIKeyHeaderAuthentication('demo-key')]);
$apiClient = \DevmeSdk\Client::create(null, [$authenticationRegistry]);

$apiClient->v1GetEmailDetails(['email' => '[email protected]', 'verifyMx' => true, 'verifySmtp' => true, 'timeout' => 3]);

// {
//   validFormat: true,
//   validMx: true,
//   validSmtp: true,
//   isFree: true,
//   isDisposable: false
// }

shell
composer