PHPackages                             tokenly-app/tokenly-php-client - 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. tokenly-app/tokenly-php-client

ActiveLibrary[API Development](/categories/api)

tokenly-app/tokenly-php-client
==============================

PHP client library for the Tokenly API

v0.0.3(3mo ago)00MITPHPPHP ^8.3

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/Tokenly-App/tokenly-php-client)[ Packagist](https://packagist.org/packages/tokenly-app/tokenly-php-client)[ RSS](/packages/tokenly-app-tokenly-php-client/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Tokenly PHP
===========

[](#tokenly-php)

PHP client library for the [Tokenly](https://tokenlyapp.com) API.

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

[](#requirements)

- PHP 8.3+
- Guzzle HTTP 7.x

Installation
------------

[](#installation)

```
composer require tokenly-app/tokenly-php-client
```

Getting credentials
-------------------

[](#getting-credentials)

Register at [tokenlyapp.com](https://tokenlyapp.com), create an app, and obtain your **App Key** and **App Secret** from the SDK page.

Usage
-----

[](#usage)

### Instantiate the client

[](#instantiate-the-client)

```
use Tokenly\TokenlyClient;

$client = new TokenlyClient(
    appKey: 'your-app-key',
    appSecret: 'your-app-secret',
);
```

### Get token balance

[](#get-token-balance)

Retrieve the current token balance for your app.

```
use Tokenly\TokenlyClient;

$client = new TokenlyClient('your-app-key', 'your-app-secret');

$balance = $client->getTokenBalance();

echo $balance->balance;        // net balance
echo $balance->tokensSent;     // total tokens sent
echo $balance->tokensReceived; // total tokens received
echo $balance->appId;          // your app ID
```

### Gift tokens

[](#gift-tokens)

Send tokens to another registered app using its app code.

```
use Tokenly\TokenlyClient;

$client = new TokenlyClient('your-app-key', 'your-app-secret');

$response = $client->giftTokens('TARGET_APP_CODE');

echo $response->message;                   // "Tokens gifted successfully"
echo $response->transaction->id;           // transaction ID
echo $response->transaction->targetAppCode; // recipient app code
echo $response->transaction->createdAt;    // ISO 8601 timestamp
```

### Error handling

[](#error-handling)

Every method throws a specific exception on failure. All exceptions extend `TokenlyException`, so you can catch them individually or as a group.

```
use Tokenly\TokenlyClient;
use Tokenly\Exceptions\AuthenticationException;
use Tokenly\Exceptions\ForbiddenException;
use Tokenly\Exceptions\TokenlyException;
use Tokenly\Exceptions\ValidationException;

$client = new TokenlyClient('your-app-key', 'your-app-secret');

try {
    $response = $client->giftTokens('TARGET_APP_CODE');
} catch (AuthenticationException $e) {
    // 401 — invalid or missing credentials
} catch (ForbiddenException $e) {
    // 403 — app is inactive or lacks permission
} catch (ValidationException $e) {
    // 400 — invalid request (e.g. gifting tokens to yourself)
} catch (TokenlyException $e) {
    // any other API error
}
```

API reference
-------------

[](#api-reference)

### `giftTokens(string $targetAppCode): GiftTokensResponse`

[](#gifttokensstring-targetappcode-gifttokensresponse)

Sends tokens to another app.

ParameterTypeDescription`$targetAppCode``string`The recipient app's unique code**`GiftTokensResponse` properties**

PropertyTypeDescription`$success``bool`Whether the request succeeded`$message``string`Human-readable result message`$transaction``Transaction`The created transaction**`Transaction` properties**

PropertyTypeDescription`$id``int`Transaction ID`$senderAppId``int`ID of the sending app`$targetAppCode``string`Code of the recipient app`$createdAt``string`ISO 8601 creation timestamp---

### `getTokenBalance(): TokenBalanceResponse`

[](#gettokenbalance-tokenbalanceresponse)

Returns the token balance for your app.

**`TokenBalanceResponse` properties**

PropertyTypeDescription`$success``bool`Whether the request succeeded`$appId``int`Your app's ID`$tokensSent``int`Total tokens sent`$tokensReceived``int`Total tokens received`$balance``int`Net balance (`received - sent`)Running tests
-------------

[](#running-tests)

```
./vendor/bin/pest
```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/504902576948b6d89fe41cd186b483afa89cc9de1b238005a5b7dcc51d33997e?d=identicon)[giacomomasseron](/maintainers/giacomomasseron)

---

Top Contributors

[![giacomomasseron](https://avatars.githubusercontent.com/u/16156317?v=4)](https://github.com/giacomomasseron "giacomomasseron (3 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tokenly-app-tokenly-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/tokenly-app-tokenly-php-client/health.svg)](https://phpackages.com/packages/tokenly-app-tokenly-php-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k34](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1942.4k4](/packages/aimeos-prisma)

PHPackages © 2026

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