betnex/sdk

Official PHP SDK for the Betnex Casino API

Maintainers

Package info

github.com/betnex2026/betnex-php-sdk

Homepage

pkg:composer/betnex/sdk

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.3 2026-06-22 04:12 UTC

This package is auto-updated.

Last update: 2026-06-22 04:15:00 UTC


README

Official PHP SDK for the Betnex Casino API.

Integrate 100+ providers and 10,000+ casino games including Slots, Live Casino, Crash Games, Sportsbook, Virtual Sports and more.

Requirements

  • PHP 8.1+
  • Composer

Installation

Install via Composer:

composer require betnex/sdk

Quick Start

<?php

require_once 'vendor/autoload.php';

use Betnex\Betnex;

$api = new Betnex(
    'YOUR_API_KEY',
    [
        'headerName' => 'x-betnex-key'
    ]
);

$providers = $api->getProviders();

print_r($providers);

Configuration

$api = new Betnex(
    'YOUR_API_KEY',
    [
        'headerName' => 'x-betnex-key',
        'timeout' => 10000,
        'retries' => 3,
        'debug' => true
    ]
);

Supported Authentication Headers

x-betnex-key
x-turnkeyxgaming-key

Get Providers

Retrieve all available providers.

$providers = $api->getProviders();

print_r($providers);

Example Response

{
  "success": true,
  "providers": ["SPRIBE", "PRAGMATICSLOTS", "EVOLUTIONLIVE"]
}

Get Games

Retrieve all games for a provider.

$games = $api->getGames('SPRIBE');

print_r($games);

Example Response

{
  "success": true,
  "provider": "SPRIBE",
  "totalGames": 16,
  "games": []
}

Launch Game

Generate a secure game launch URL.

$launch = $api->launchGame([
    'username' => 'testuser',
    'gameId' => 'a04d1f3eb8ccec8a4823bdf18e3f0e84',
    'money' => 1000,
    'platform' => 1,
    'currency' => 'INR',
    'home_url' => 'https://example.com',
    'lang' => 'en'
]);

print_r($launch);

Example Response

{
  "code": 0,
  "msg": "Success",
  "payload": {
    "game_launch_url": "https://livecasinoapi.betnex.co/game?token=...",
    "game_name": "Aviator",
    "provider": "SPRIBE",
    "expires_in": 60
  }
}

Callback Validation

Validate callback payloads received from Betnex.

use Betnex\Utils\VerifyCallback;

$callback = VerifyCallback::verify(
    $payload,
    $apiKey
);

print_r($callback);

Example Callback Payload

$payload = [
    'bet_amount' => 100,
    'win_amount' => 0,
    'member_account' => 'testuser',
    'game_uid' => 'a04d1f3eb8ccec8a4823bdf18e3f0e84',
    'game_round' => '9356359715438476370',
    'serial_number' => '955fbea9-6cd0-356c-8302-7326fa647c6d',
    'currency_code' => 'INR',
    'api_key' => 'YOUR_API_KEY',
    'game_name' => 'AVIATOR',
    'game_provider' => 'SPRIBE'
];

Example Response

Array
(
    [valid] => true
    [bet_amount] => 100
    [win_amount] => 0
    [member_account] => testuser
    ...
)

Calculate Balance

Helper function for balance calculations.

Formula:

currentBalance - betAmount + winAmount

Example:

use Betnex\Utils\CalculateBalance;

$newBalance = CalculateBalance::calculate(
    1000,
    100,
    50
);

echo $newBalance;

Output:

950

Callback Response Helper

Generate standardized callback responses.

use Betnex\Utils\CallbackResponse;

$response = CallbackResponse::create([
    'success' => true,
    'handle' => true,
    'money' => 900,
    'msg' => 'Callback processed successfully'
]);

print_r($response);

Example Response

{
  "success": true,
  "msg": "Callback processed successfully",
  "handle": true,
  "money": 900
}

Error Handling

try {

    $providers = $api->getProviders();

} catch (\Throwable $e) {

    echo $e->getMessage();
}

Debug Mode

Enable SDK request logging.

$api = new Betnex(
    $apiKey,
    [
        'debug' => true
    ]
);

API Endpoints

GET  /casino/getallproviders
GET  /casino/getallgamesandprovider
POST /casino/getgameurl

Version

SDK Version: 1.0.3

Support

Website

https://casinoapi.betnex.co

Email

contact@betnex.co

License

MIT License

Copyright (c) Betnex