PHPackages                             codd-tech/bap-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. codd-tech/bap-sdk-php

ActiveLibrary[API Development](/categories/api)

codd-tech/bap-sdk-php
=====================

Bot Advertising Platform SDK

v0.2.6(2y ago)19011MITPHPPHP &gt;=5.3.0

Since Nov 3Pushed 2y ago2 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (10)Used By (0)

Bot Advertising Platform SDK
============================

[](#bot-advertising-platform-sdk)

This repository holds SDK related to [Bot Advertising Platform](https://publisher.socialjet.pro/).

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

[](#requirements)

- PHP 5.3 or later
- ext-sockets

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

[](#installation)

Install the latest version with

```
composer require codd-tech/bap-sdk-php
```

### Installing ext-sockets

[](#installing-ext-sockets)

The [socket extension](https://www.php.net/manual/en/book.sockets.php) implements a low-level interface to the socket communication.

The BAP SDK uses the UDP protocol for data transfer to ensure minimal SDK overhead for the user.

To install socket extension add the following line to your `php.ini`:

```
extension=php_sockets.dll
```

Or add `RUN docker-php-ext-install sockets` to your project's Dockerfile if you are using [official php image](https://hub.docker.com/_/php).

Usage
-----

[](#usage)

SDK accepts single update from the Telegram bot as an associative array.

### Basic usage

[](#basic-usage)

```
$bap = new \CoddTech\Bap\BAP('');
$bap->handleTelegramUpdates($update);
```

If your advertisement mode is set to **manual** you can mark ad placement in your code by calling:

```
$bap->advertisement($update);
```

**Interrupting control flow**

At times, BAP may introduce telegram updates within its advertisement flow. To maintain the logical consistency of your bot, it is necessary to ignore such updates.

The `BAP::handleTelegramUpdates` method returns a boolean value indicating whether you should proceed with handling the request or skip it as an internal BAP request.

When the method returns `false`, it signifies that the current request should not be processed by your bot.

### Usage with PHP Telegram Bot package

[](#usage-with-php-telegram-bot-package)

If you are using PHP Telegram Bot package you can call SDK inside custom update filter, eg:

```
$telegram = new Longman\TelegramBot\Telegram($bot_api_key, $bot_username);

$bap = new \CoddTech\Bap\BAP('');
$telegram->setUpdateFilter(function (Update $update, Telegram $telegram, &$reason = 'Update denied by update_filter') use ($bap) {
    return $bap->handleTelegramUpdates($update->getRawData());
});
```

For manual advertisement mode(Should be turned on in settings) call following in the desired ad placements.

```
$bap->advertisement($update);
```

### API Key

[](#api-key)

**API key is not your Telegram bot token.**

API key must be obtained from [socialjet.pro](https://publisher.socialjet.pro/)

About
-----

[](#about)

### Submitting bugs and feature requests

[](#submitting-bugs-and-feature-requests)

Bugs and feature request are tracked on [GitHub](https://github.com/codd-tech/bap-sdk-php)

### License

[](#license)

Bot Advertising Platform SDK is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72.7% 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 ~82 days

Recently: every ~71 days

Total

7

Last Release

795d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cdee073887535311ab87169d36841849894faa01f8811ca17f025587388af37?d=identicon)[aggrrrh](/maintainers/aggrrrh)

---

Top Contributors

[![kkkotov](https://avatars.githubusercontent.com/u/126066562?v=4)](https://github.com/kkkotov "kkkotov (8 commits)")[![aggrrrh](https://avatars.githubusercontent.com/u/3205165?v=4)](https://github.com/aggrrrh "aggrrrh (3 commits)")

---

Tags

advertisingcpaphpphp-librarysdktelegramadsbottelegram

### Embed Badge

![Health badge](/badges/codd-tech-bap-sdk-php/health.svg)

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

###  Alternatives

[longman/telegram-bot

PHP Telegram bot

4.0k2.1M50](/packages/longman-telegram-bot)[telegram-bot/api

PHP Wrapper for Telegram Bot API

1.2k2.4M29](/packages/telegram-bot-api)[tg-bot-api/bot-api-base

Clear and simple Telegram bot API

22278.8k2](/packages/tg-bot-api-bot-api-base)[botman/driver-telegram

Telegram driver for BotMan

92437.3k6](/packages/botman-driver-telegram)[phptg/bot-api

PHP library for working with Telegram API

1218.5k4](/packages/phptg-bot-api)[luzrain/telegram-bot-api

PHP Wrapper for Telegram Bot API

1032.8k1](/packages/luzrain-telegram-bot-api)

PHPackages © 2026

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