betnex/sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

betnex/sdk

Composer 安装命令:

composer require betnex/sdk

包简介

Official PHP SDK for the Betnex Casino API

README 文档

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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固