PHPackages                             chanify/sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. chanify/sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chanify/sdk
===========

Official Chanify SDK - monetize your Telegram bot with ads

0.1.0(1mo ago)00MITPHPPHP &gt;=8.0

Since May 2Pushed 1mo agoCompare

[ Source](https://github.com/chanifyonline/sdk-php)[ Packagist](https://packagist.org/packages/chanify/sdk)[ Docs](https://chanify.online)[ RSS](/packages/chanify-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Chanify PHP SDK
===============

[](#chanify-php-sdk)

Official PHP SDK for [Chanify](https://chanify.online) — the ad network for Telegram bots, channels, and Mini Apps.

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

[](#installation)

```
composer require chanify/sdk
```

Quick Start
-----------

[](#quick-start)

```
use Chanify\Client;

$chanify = new Client('chanify_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

// After each bot response — add one line:
$chanify->showAd($chatId, [
    'userId'       => $userId,
    'languageCode' => $languageCode,
    'isPremium'    => $isPremium,
]);
```

Full API
--------

[](#full-api)

```
$chanify->showAd(int $chatId, array $userMeta = []): bool
```

ParameterTypeRequiredDescription`chatId`intYesTelegram chat ID`userMeta['userId']`intNoTelegram user ID`userMeta['languageCode']`stringNoUser language code, e.g. `"en"``userMeta['isPremium']`boolNoWhether the user has Telegram Premium`userMeta['country']`stringNoISO 3166-1 alpha-2 country codeReturns `true` if an ad was shown, `false` otherwise. **Never throws exceptions** — safe to call without try/catch.

Example with Telegram Bot API
-----------------------------

[](#example-with-telegram-bot-api)

```
