chanify/sdk

Official Chanify SDK - monetize your Telegram bot with ads

Maintainers

Package info

github.com/chanifyonline/sdk-php

Homepage

pkg:composer/chanify/sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-05-02 01:45 UTC

This package is auto-updated.

Last update: 2026-05-02 02:19:24 UTC


README

Official PHP SDK for Chanify — the ad network for Telegram bots, channels, and Mini Apps.

Installation

composer require chanify/sdk

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

$chanify->showAd(int $chatId, array $userMeta = []): bool
Parameter Type Required Description
chatId int Yes Telegram chat ID
userMeta['userId'] int No Telegram user ID
userMeta['languageCode'] string No User language code, e.g. "en"
userMeta['isPremium'] bool No Whether the user has Telegram Premium
userMeta['country'] string No ISO 3166-1 alpha-2 country code

Returns true if an ad was shown, false otherwise. Never throws exceptions — safe to call without try/catch.

Example with Telegram Bot API

<?php

require 'vendor/autoload.php';

use Chanify\Client;

$chanify = new Client('chanify_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

$update = json_decode(file_get_contents('php://input'), true);
$message = $update['message'] ?? null;

if ($message) {
    $chatId   = $message['chat']['id'];
    $userId   = $message['from']['id'];
    $lang     = $message['from']['language_code'] ?? null;
    $premium  = $message['from']['is_premium'] ?? false;

    // Send your bot's response first
    // ...

    // Then show an ad
    $chanify->showAd($chatId, [
        'userId'       => $userId,
        'languageCode' => $lang,
        'isPremium'    => $premium,
    ]);
}

Requirements

  • PHP 8.0+
  • ext-curl
  • ext-json

Get your API key

  1. Sign up at chanify.online
  2. Go to Publisher → My Bots → Add Bot
  3. Copy your chanify_live_ API key from Step 3

Links

License

MIT