PHP code example of bespoke / improvmx

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

    

bespoke / improvmx example snippets


$improvMx = new ImprovMx();
$client = $improvMx->client();

$client = new Bespoke\ImprovMX\Client("INPUT_API_KEY_MANUALLY");

$client->account()->getAccountDetails();
$client->domains()->list();

$improvMx = new ImprovMX();

// Return the Account entity.
$accountDetails = $improvMx->client()->account()->getAccountDetails();

// Return a collection of white-labelled domains.
$domains = $improvMx->client()->account()->getWhiteLabeledDomains();

$improvMx = new ImprovMX();

// Return a collection of Domain entities.
$domains = $improvMx->client()->domains()->list();

// Returns the newly created Domain entity or null (if failed to create).
$improvMx->client()->domains()->add("domain.com", "[email protected]", "whitelabel-domain.com");

// Return the Domain entity (or null).
$domain = $improvMx->client()->domains()->get("test.com");

// Update the details for a domain - returns the Domain entity or null.
$improvMx->client()->domains()->update("domain.com", "[email protected]", "whitelabel-domain.com");

// Returns delete successful - true or false.
$success = $improvMx->client()->domains()->delete("domain.com");

// Returns a RecordValidity entity.
$details = $improvMx->client()->domains()->checkDomainValidity("domain.com");

$improvMx = new ImprovMX();

// Return a collection of Alias entities for a domain.
$aliases = $improvMx->client()->aliases()->list("domain.com");

// This command sets up email forwarding from [email protected] to [email protected].
// Returns the newly created Alias entity or null (if failed to create).
$improvMx->client()->aliases()->add("domain.com", "user", "[email protected]");

// Return the Alias entity (or null) for a given alias e.g. ([email protected]).
$alias = $improvMx->client()->aliases()->get("domain.com", "alias");

// Update the forwarding address for an alias - returns the Alias entity or null.
$improvMx->client()->aliases()->update("domain.com", "alias", "[email protected]");

// Returns delete successful - true or false.
$success = $improvMx->client()->aliases()->delete("domain.com", "alias");

$improvMx = new ImprovMX();

// Return a collection of Log entities for a domain.
$logs = $improvMx->client()->logs()->getDomainLogs("domain.com");

// Return a collection of Log entities for a domain's alias.
$logs = $improvMx->client()->logs()->getAliasLogs("domain.com", "alias");

$improvMx = new ImprovMX();

// Return a collection of Credential entities for a domain.
$credentials = $improvMx->client()->smtpCredentials()->list("domain.com");

// Add a new SMTP account for a domain (returns with the Credential entity or null).
$logs = $improvMx->client()->smtpCredentials()->add("domain.com", "username", "password");

// Update the password for an SMTP account (by username) - returns the Credential entity or null.
$improvMx->client()->smtpCredentials()->update("domain.com", "username", "newPassword");

// Returns delete successful - true or false.
$success = $improvMx->client()->smtpCredentials()->delete("domain.com", "username");