PHP code example of mtxserv / mtxserv-php

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

    

mtxserv / mtxserv-php example snippets




$client = \Mtxserv\Client::factory(array(
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'api_key'       => 'YOUR_API_KEY'
));



$client = \Mtxserv\Client::factory(array(
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'api_key'       => 'YOUR_API_KEY'
));

$products = $client->getProducts(); 
var_dump($products);



$client = \Mtxserv\Client::factory(array(
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'api_key'       => 'YOUR_API_KEY'
));

$product = $client->getProduct(array(
    'id' => 1337 # 



$client = \Mtxserv\Client::factory(array(
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'api_key'       => 'YOUR_API_KEY'
));

$viewer = $client->getGameViewer(array(
    'type' => 'GAME_SERVER_TYPE', # ex: minecraft
    'ip'   => 'GAME_SERVER_IP',
    'port' => GAME_SERVER_PORT
)); 

var_dump($viewer);



$client = \Mtxserv\Client::factory(array(
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
    'api_key'       => 'YOUR_API_KEY'
));

$administrators = $client->getAdmins(array(
    'id' => 1337 #