PHPackages                             thisismzm/tdlib-php-ffi - 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. thisismzm/tdlib-php-ffi

ActiveLibrary[API Development](/categories/api)

thisismzm/tdlib-php-ffi
=======================

An implementation of Telegram's TDLib in PHP by FFI extension

v1.0.0(3y ago)211.1k1MITPHP

Since Jun 5Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/thisismzm/tdlib-php-ffi)[ Packagist](https://packagist.org/packages/thisismzm/tdlib-php-ffi)[ RSS](/packages/thisismzm-tdlib-php-ffi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

TDLib PHP FFI
=============

[](#tdlib-php-ffi)

An implementation of Telegram's TDLib in PHP by FFI extension

Docs
----

[](#docs)

### Create an instance

[](#create-an-instance)

```
/**
* @param string|null $tdlibFilePath A file path/name to `libtdjson.so` library
*/
public function __construct(string $tdlibFilePath)
```

### Create client id

[](#create-client-id)

Returns an opaque identifier of a new TDLib instance. The TDLib instance will not send updates until the first request is sent to it.

```
/**
 * @return int an opaque identifier of a new TDLib instance
 */
public function createClientId(): int
```

### Send request

[](#send-request)

Sends request to the TDLib client. May be called from any thread.

```
/**
 * @param int $clientId TDLib client id
 * @param string $request $request JSON-serialized request to TDLib.
 *
 * @return void
 */
public function send(int $clientId, string $request): void
```

### Receive response and updates

[](#receive-response-and-updates)

Receives incoming updates and request responses. Must not be called simultaneously from two different threads.

```
/**
 * @param int $timeout The maximum number of seconds allowed for this function to wait for new data
 *
 * @return string|null incoming update or request response or may be null if the timeout expires.
 */
public function receive(int $timeout): ?string
```

### Synchronously executes a request

[](#synchronously-executes-a-request)

Synchronously executes a TDLib request. A request can be executed synchronously, only if it is documented with "Can be called synchronously".

```
/**
* @param string $request JSON-serialized request to TDLib.
*
* @return string|null JSON-serialized null-terminated request response.
*/
public function execute(string $request): ?string
```

💜 Support this project
----------------------

[](#-support-this-project)

If this project saves you time or money, consider supporting its development.

**Crypto donations:**

- Toncoin (TON): `UQCI2hg2r7TV9xFS-4H6uRlySPRkYUlEVQm-BDhlPAAaVpfb`

Thank you for supporting open-source ❤️

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance54

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

1443d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30a32f8aacbfb760572f812c0eeeb6a7e6d85fa957d794122669eda91850e025?d=identicon)[thisismzm](/maintainers/thisismzm)

---

Top Contributors

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

---

Tags

tdlibtdlib-phptelegram-clienttelegram-phptelegram-php-clienttelegram-tdlib

### Embed Badge

![Health badge](/badges/thisismzm-tdlib-php-ffi/health.svg)

```
[![Health](https://phpackages.com/badges/thisismzm-tdlib-php-ffi/health.svg)](https://phpackages.com/packages/thisismzm-tdlib-php-ffi)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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