PHPackages                             expertskb/telegram\_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. [Database &amp; ORM](/categories/database)
4. /
5. expertskb/telegram\_php

ActiveLibrary[Database &amp; ORM](/categories/database)

expertskb/telegram\_php
=======================

The 'TelegramPhp' class facilitates database backup operations by exporting tables and data into a SQL file.

1.3(1y ago)011GPL-2.0-or-laterPHPPHP &gt;=5.6

Since Apr 20Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Here's an updated version of the README.md guide with additional information about the `setDebug()` method:

---

TelegramPhp Database Backup Library
===================================

[](#telegramphp-database-backup-library)

The `TelegramPhp` class facilitates database backup operations by exporting tables and data into a SQL file and sending it to a Telegram chat. This library is useful for automating database backups and sending them to specified Telegram chats for storage and monitoring.

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

[](#installation)

You can install this library via Composer. Run the following command in your terminal:

```
composer require expertskb/telegram_php
```

Usage
-----

[](#usage)

### Step 1: Initialize the Backup Class

[](#step-1-initialize-the-backup-class)

First, you need to initialize the `Backup` class by providing the necessary parameters:

```
use Expertskb\TelegramPhp\Backup;

// Initialize the Backup class
$backup = new Backup($host, $username, $database, $password, $bot_token, $chat_id);
```

- `$host`: The hostname of the database server.
- `$username`: The username used to connect to the database.
- `$database`: The name of the database to be backed up.
- `$password`: The password used to connect to the database.
- `$bot_token`: The Telegram bot token used to send the backup file.
- `$chat_id`: The ID of the Telegram chat or an array of chat IDs where you want to send the backup.

### Step 2: Run the Backup Process

[](#step-2-run-the-backup-process)

To start the backup process, simply call the `run()` method of the `Backup` class:

```
$backup->run();
```

This will export the database tables and data into a SQL file and send it to the specified Telegram chat(s).

### Optional: Enable Debug Mode

[](#optional-enable-debug-mode)

You can enable debug mode to receive detailed logs by calling the `setDebug()` method:

```
$backup->setDebug(true);
```

### Example

[](#example)

```
use Expertskb\TelegramPhp\Backup;

// Initialize the Backup class
$backup = new Backup('localhost', 'username', 'my_database', 'password', 'your_bot_token', ['ps_your_id1', 'ps_your_id2']);

// Enable debug mode
$backup->setDebug(true);

// Run the backup process
$backup->run();
```

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

[](#requirements)

- PHP 5.6 or higher
- MySQLi extension enabled
- cURL extension enabled

License
-------

[](#license)

This library is open-source and released under the MIT License. See the [LICENSE](LICENSE) file for details.

---

Feel free to customize this README according to your preferences and add any additional information or usage examples as needed.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~12 days

Total

4

Last Release

718d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c41487c2b51c0ba37acdf83ce582eca854517990097c67df3c033f76ffc6549d?d=identicon)[expertskb](/maintainers/expertskb)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/expertskb-telegram-php/health.svg)

```
[![Health](https://phpackages.com/badges/expertskb-telegram-php/health.svg)](https://phpackages.com/packages/expertskb-telegram-php)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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