PHP code example of shockmediabv / myshock-php-client

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

    

shockmediabv / myshock-php-client example snippets




hockMedia\Generated\Domain\DomainClient;
use ShockMedia\Generated\Domains\DomainFilter;
use ShockMedia\Generated\PageRequest;
use ShockMedia\Generated\SimpleHttpClient;
use ShockMedia\Generated\SortField;
use ShockMedia\Generated\SortField\DirectionAlt2;

// The API location and credentials
$url = 'https://my.shockmedia.nl/openrpc/';
$authorizationHeader = 'ApiKey <your api key here>';

// The HTTP client to use. Can be swapped out for a custom implementation, for example using cURL.
$client = new SimpleHttpClient($url, $authorizationHeader);

// Create a client for interacting with the Domain endpoint
$domainClient = new DomainClient($client);

// Example call: list the first 10 domains of a user, sorted by name, without any filters.
$result = $domainClient->listDomains(
    new PageRequest([new SortField('name', DirectionAlt2::ASC)], 0, 10), 
    new DomainFilter(null)
 );

// Output the example result
var_dump($result);
bash
composer