PHPackages                             spinshield/spinclient - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. spinshield/spinclient

ActiveLibrary[HTTP &amp; Networking](/categories/http)

spinshield/spinclient
=====================

1.0.8(5mo ago)119.3k↓32.5%1MITPHPPHP &gt;=5.3.0

Since Oct 15Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/spinshield/spinclient)[ Packagist](https://packagist.org/packages/spinshield/spinclient)[ Docs](https://github.com/spinshield)[ RSS](/packages/spinshield-spinclient/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

Spinclient
==========

[](#spinclient)

To assist easier integration for operators using PHP. Works on any PHP &gt; 5, requires GuzzleHttp.

You can use this package in your existing PHP based projects. This includes any PHP based framework, like Laravel, Lumen, Yiii and so on.

Install
=======

[](#install)

Run in your PHP project: `composer require spinshield/spinclient`

Function Overview
-----------------

[](#function-overview)

### API Client Functions

[](#api-client-functions)

```
// e.g. getGame("player123", "playerPass123", "platipus/egyptiangold", "USD", "https://casino.com", "https://casino.com/deposit", 0, "en");
getGame($username, $userpassword, $game_id, $currency, $homeurl, $cashierurl, $play_for_fun, $lang);

// e.g. getGameDemo("platipus/egyptiangold", "USD", "https://casino.com", "https://casino.com/deposit", "en");
getGameDemo($game_id, $currency, $homeurl, $cashierurl, $lang);

// e.g. getGameList("USD", 1);
getGameList($currency, $list_type);

// e.g. createPlayer("player123", "playerPass123", "Malone", "USD");
createPlayer($username, $userpassword, $usernickname, $currency);

// e.g. addFreeRounds("player123", "playerPass123", "platipus/egyptiangold", "USD", 10, 0);
addFreeRounds($username, $userpassword, $game_id, $currency, $freespins, $betlevel);

// e.g. getFreeRounds("player123", "playerPass123", "USD");
getFreeRounds($username, $userpassword, $currency);

// e.g. deleteFreeRounds("platipus/egyptiangold", "player123", "playerPass123", "USD");
deleteFreeRounds($gameid, $username, $userpassword, $currency);

// e.g. deleteFreeRounds("player123", "playerPass123", "USD");
deleteAllFreeRounds($username, $userpassword, $currency);
```

### Helpers Functions

[](#helpers-functions)

This package also includes helpers to assist you in for example returning responses on callbacks. See examples below how to implement.

Helper functions to assist you on callbacks:

```
// validate the callback request coming from our gameserver, take 'key', 'timestamp' from each callback and salt from your apikey configuration in backoffice
isValidKey($key, $timestamp, $salt);

// construct balance response in JSON format
balanceResponse($intBalance);

// construct insufficient balance in JSON format
insufficientBalance($intBalance);

//construct generic error reponse (when you have error processing callback) in JSON format
processingError();
```

Generic Helper functions:

```
// check for error code on api responses
responseHasError($apiResponse);

// morphs json object to associative array
morphJsonToArray($input);

// because our API communicates using int value in cents, this can assist you to convert for example ($) 2.00 to 200 securely
floatToIntHelper($floatValue);

// converts int back to float (2 decimals)
intToFloatHelper($intValue);
```

Examples
--------

[](#examples)

### PHP Usage Example

[](#php-usage-example)

```
