PHP code example of slotsgateway / slotsgateway-php-client

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

    

slotsgateway / slotsgateway-php-client example snippets


// Open a real-money game session
getGame(
  $username,
  $userpassword,
  $game_id,
  $currency,
  $homeurl,
  $cashierurl,
  $play_for_fun,
  $lang
);

// Open a demo (fun-play) game session
getGameDemo(
  $game_id,
  $currency,
  $homeurl,
  $cashierurl,
  $lang
);

// Retrieve the game list
getGameList(
  $currency,
  $list_type
);

// Create or initialize a player
createPlayer(
  $username,
  $userpassword,
  $usernickname,
  $currency
);

// Add free spins to a player
addFreeRounds(
  $username,
  $userpassword,
  $game_id,
  $currency,
  $freespins,
  $betlevel
);

// Retrieve free spins history
getFreeRounds(
  $username,
  $userpassword,
  $currency
);

// Delete free spins for a specific game
deleteFreeRounds(
  $gameid,
  $username,
  $userpassword,
  $currency
);

// Delete all free spins for a player
deleteAllFreeRounds(
  $username,
  $userpassword,
  $currency
);

// Validate callback signature using key, timestamp, and your API salt key
isValidKey($key, $timestamp, $salt);

// Return a valid balance response (integer, cents)
balanceResponse($intBalance);

// Return an insufficient balance response
insufficientBalance($intBalance);

// Return a generic processing error response
processingError();

// Check if an API response contains an error
responseHasError($apiResponse);

// Convert a JSON object into an associative array
morphJsonToArray($input);

// Convert float balance (e.g. 2.00) to integer cents (200)
floatToIntHelper($floatValue);

// Convert integer cents back to float (2 decimals)
intToFloatHelper($intValue);


use slotsgateway\client;

([
  "endpoint"     => "https://secretendpoint.com",
  "api_login"    => "12345",
  "api_password" => "12345",
]);

var_export($client->getGameList("USD", 1));

// routes/web.php
Route::get('/slotsgateway_example/gamelist', [\App\Http\Controllers\SlotsgatewayController::class, 'gamelist']);
Route::get('/slotsgateway_example/gameflow', [\App\Http\Controllers\SlotsgatewayController::class, 'gameflow']);



namespace App\Http\Controllers;

use slotsgateway\client;

class SlotsgatewayController extends Controller
{
  protected $client;
  protected $helpers;

  public function __construct()
  {
    $this->client = new client\ApiClient([
      "endpoint"     => "https://secretendpoint.net",
      "api_login"    => "12345",
      "api_password" => "12345",
    ]);

    $this->helpers = new client\Helpers();
  }

  public function gamelist()
  {
    return $this->client->getGameList("USD", 1);
  }

  public function gameflow()
  {
    $createPlayer = $this->client->createPlayer(
      "playerId1337",
      "playerPassword",
      "Tiernan",
      "USD"
    );

    if ($this->helpers->responseHasError($createPlayer)) {
      return $createPlayer;
    }

    return $this->client->getGame(
      "playerId1337",
      "playerPassword",
      "platipus/egyptiangold",
      "USD",
      "https://casino.com",
      "https://casino.com/deposit",
      0,
      "en"
    );
  }
}
bash
composer