PHPackages                             tebex/tebex-sdk-php - 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. [API Development](/categories/api)
4. /
5. tebex/tebex-sdk-php

ActiveLibrary[API Development](/categories/api)

tebex/tebex-sdk-php
===================

Gaming payments done right - Tebex is the monetization platform designed to grow your gaming revenue streams

v1.1.1(3mo ago)0695↑18.6%5MITPHPPHP &gt;=7.4

Since Jun 9Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/tebexio/tebex-sdk-php)[ Packagist](https://packagist.org/packages/tebex/tebex-sdk-php)[ RSS](/packages/tebex-tebex-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Tebex PHP SDK
=============

[](#tebex-php-sdk)

The Tebex PHP library provides access to Tebex APIs from applications written using PHP.

Requirements
------------

[](#requirements)

PHP 7.4.0 or above.

Composer
--------

[](#composer)

Install the SDK via [Composer](https://getcomposer.org/) using the following command:

```
composer require tebex/tebex-sdk-php
```

Use Composer's autoload to use the Tebex library.

```
require_once 'vendor/autoload.php';
```

Dependencies
------------

[](#dependencies)

The following PHP extensions must be installed in your PHP environment:

- `curl`
- `json`

Composer will install these extensions automatically. If installing manually, ensure these extensions are available and enabled for your PHP distribution.

Examples
--------

[](#examples)

### Headless API

[](#headless-api)

Headless allows interaction with your Tebex project using pre-defined packages and is available for all stores.

```
$project = Headless::setProject("your-public-token");

// Interact with the project through $project
$categories = $project->listCategories();
$packages = $project->listPackages();
$project->getCategory(12345);
$project->getPackage(67890);

// Create baskets through the project, providing completion and cancellation urls
$basket = $project->createBasket("https://tebex.io/completed", "https://tebex.io/cancelled");

// If the project requires auth, direct the user to authorize before adding packages
if ($project->requiresUserAuth()) {
    $authUrl = $project->getUserAuthUrl($basket, "https://tebex.io/auth-return");
    echo "- User auth required at: " . $authUrl . ".\n";
}

// Once user is successfully authed we can add packages via $basket
$package = $packages[0];

$basket = $basket->addPackage($package);
$basket = $basket->addGiftedPackage($package, "Tebex");
$basket = $basket->addGiftCardPackage($package, "tebex-integrations@overwolf.com");

// You can also add variable data as needed per each package
$basket->addPackage($package, [
    "server_id" => "127244"
]);

// Each function returns the remote basket after completion, but you can always request the current basket from the API
$basket = $basket->refreshBasket();

// Query the $basket object for any info
echo "Price: $" . $basket->getBasePrice() . "\n";

// Go to checkout
$checkoutLink = $basket->getLinks()->getCheckout();
echo "Checkout at: " . $checkoutLink;
```

### Webhooks

[](#webhooks)

Webhooks are sent to authorized endpoints configured within your Tebex creator panel. They contain information about events that occur in your project such as payments, refunds, and disputes.

**Note:** The secret key must be your **webhook key** provided at

```
// You must set your secret key first so that webhooks can be validated.
Webhooks::setSecretKey("2248c2227ac29e5cbdbab44ed6a0f961");

// Is read from php://input unless an argument is provided
$webhook = Webhook::parse();

// You can check for specific webhook types
if ($webhook->isType(\Tebex\Webhook\VALIDATION_WEBHOOK)) {
    echo json_encode(["id" => $webhook->getId()]); // Respond to validation endpoint
}

// You can quickly check the type of webhook with helper functions as well
else if ($webhook->isTypeOfPayment() || $webhook->isTypeOfDispute())
{
    // The "subject" contains data about the webhook action
    $pmtSubject = $webhook->getSubject(); // type is \TebexCheckout\Model\PaymentSubject
    // etc....
}
else if ($webhook->isTypeOfRecurringPayment()) {
    $recurringPmtSubject = $webhook->getSubject(); // \TebexCheckout\Model\RecurringPaymentSubject
    // etc...
}
```

### Checkout API

[](#checkout-api)

The Checkout API allows collecting payment for ad-hoc products not defined in a Tebex project.

This API requires prior approval. Please contact Tebex support to enable on your account.

```
// Authorize your store using your API keys
Checkout::setApiKeys("projectId", "privateKey");
```

#### Creating Baskets

[](#creating-baskets)

Use the `Checkout\BasketBuilder` to create and manage your baskets.

```
// Use the BasketBuilder to create your basket for Checkout
$builder = Checkout\BasketBuilder::new()
    ->email("tebex-integrations@overwolf.com")
    ->firstname("Tebex")
    ->lastname("Integrations")
    ->ip("127.0.0.1") // provide client IP if running on your backend server
    ->returnUrl("https://tebex.io/")
    ->completeUrl("https://tebex.io/");
```

#### Adding Packages

[](#adding-packages)

Use the `Checkout\PackageBuilder` to create the packages you wish to add to your basket.

```
$package1 = Checkout\PackageBuilder::new()->name("100 Gold")->qty(1)->price(1.27)
    ->oneTime();

$package2 = Checkout\PackageBuilder::new()->name("1 Month Sub")->qty(1)->price(2.44)
    ->subscription()->monthly()->expiryLength(1);
```

#### Checkout Request (Recommended)

[](#checkout-request-recommended)

You can use `Checkout::checkoutRequest` to send basket information and its products in a single request. The list of packages should be an array of `CheckoutItem`, which can be provided by the `PackageBuilder` with `buildCheckoutItem()`.

```
$builder = Checkout\BasketBuilder::new()
    ->email("support@tebex.io")->firstname("Tebex")->lastname("Support")
    ->ip($_SERVER["REMOTE_ADDR"])
    ->returnUrl("https://tebex.io/")->completeUrl("https://tebex.io/");

$package1 = Checkout\PackageBuilder::new()->name("100 Gold")->qty(1)->price(1.27)->oneTime();
$basket = Checkout::checkoutRequest($builder, [$package1->buildCheckoutItem()]);

echo "Checkout at: " . $basket->getLinks()->getCheckout();
```

### ❓ API Documentation

[](#-api-documentation)

Our APIs are fully documented at  as a resource for all options, events, and advanced functionality possible through Tebex.

🔗 Useful Links
--------------

[](#-useful-links)

- [Tebex API Documentation](https://docs.tebex.io/developers)
- [Headless API Documentation](https://docs.tebex.io/developers/headless-api/overview)
- [Checkout API Documentation](https://docs.tebex.io/developers/checkout-api/overview)

Contributions
-------------

[](#contributions)

This SDK is open source and we welcome contributions from the community. If you wish to make a contribution, please review **CONTRIBUTING.md** for guidelines and things to know before making your contribution.

🙋‍♂️ Support
------------

[](#‍️-support)

For issues relating to this library, please raise an issue in its repository. Otherwise you may also contact .

###  Health Score

41

—

FairBetter than 88% of packages

Maintenance87

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~239 days

Total

2

Last Release

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bb8b6b98cb780c8eccfb697135de5e0508ed80e170395336e94f21b43bea230?d=identicon)[Tebex](/maintainers/Tebex)

---

Top Contributors

[![WildBamaBoy](https://avatars.githubusercontent.com/u/749179?v=4)](https://github.com/WildBamaBoy "WildBamaBoy (15 commits)")[![pulseP1986](https://avatars.githubusercontent.com/u/160108743?v=4)](https://github.com/pulseP1986 "pulseP1986 (2 commits)")[![btwlouis](https://avatars.githubusercontent.com/u/56355239?v=4)](https://github.com/btwlouis "btwlouis (1 commits)")[![TebexOllie](https://avatars.githubusercontent.com/u/62796605?v=4)](https://github.com/TebexOllie "TebexOllie (1 commits)")

---

Tags

apisdkpayment processingpaymentsgaminggame-development

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tebex-tebex-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/tebex-tebex-sdk-php/health.svg)](https://phpackages.com/packages/tebex-tebex-sdk-php)
```

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[invoiced/invoiced

Invoiced PHP Library

14117.1k](/packages/invoiced-invoiced)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
