Download the PHP package bagart/telegram-bot-lib without Composer

On this page you can find all versions of the php package bagart/telegram-bot-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package telegram-bot-lib

telegram-bot-lib

Pure Telegram Bot API library.

Installation

Commands

commands/poller.php

Long polling with DTO (typed objects).

commands/poller-raw.php

Long polling in raw mode: no DTOs, no Processors, no Registry

commands/mapper.php

Simulate incoming webhook payloads. Offline DTO mapper example

commands/webhook.php

You can configure your bot webhook via web interface: bagart.github.io/tg-webhook. Is more powerful and useful.

Manage webhook — show current, set or delete. Secret is auto-generated in format {botId}:{sha256(tokenPart)}.

commands/actualize.sh

Generate Telegram Bot API DTOs. Actualize is mean: npm update schema + build json + generate DTOs

Webhook Entry Point

Framework-free Example of Webhook entry point for web server with DTOProcessors (default: echo, store) Usage: point your web server to telegram-bot-lib/public/

Allowed Security:

Processors

Update processors handle incoming Telegram updates. Build-in DTOProcessors

Processor Description
Processing Build-in Technical
MessageEchoProcessor Reply with "echo: {text}"
MessagePdoStoreProcessor Store messages to SQLite database
UpdateLoggerProcessor Log messages to stderr

Register processors:

Benchmarks

DNS resolution benchmark (./cmd/xhprof_bench_dns):

Ranked by time (fastest → slowest):

  1. ask-dns — 0.0648s (724.9 rps, fairness 98/100, mem 10.0 MB)
  2. react-dns — 0.0721s (651.7 rps, fairness 97/100, mem 10.0 MB)
  3. amphp-dns — 0.2421s (194.1 rps, fairness 100/100, mem 20.0 MB, 10.0 MB Δ)
  4. native — 2.4466s (19.2 rps, fairness 96/100, mem 10.0 MB)

Components

commands - framework-free command for polling and set webhook public - Framework-free Example of Webhook entry point for web server with DTOProcessors src/ - framework-free Telegram Bot lib ├── ApiCommunication/ — Guzzler async client and TelegramBot specific options │ ├── TgBotApiClient — raw Guzzle Api client to Telegram │ └── TgBotApiDTOClient — full DTO Telegram Client ├── BotServices/ │ ├── AutoSecretByTokenService — secret service as {botId}:{sha256(tokenPart)} │ ├── BotRegistry — Registry of bot to use them by tokens or secrets(webhook) │ ├── BotSecretDTO — Bot token and secret DTO │ └── WebhookManager — get/set/delete webhook, auto-secret, buildTextInfo ├── Contracts/ - All copde with strict consistency contracts ├── DevTool/ │ └── DTOGenerator — DTO AutoGenerator for Telegram Types and Methods ├── ExampleServices/ — framework-free services │ ├── TgPureFactory — factory for example commands and webhook │ └── TinyFileCache — simple framework-free PSR-16 file cache implementation ├── Http/ │ ├── Validators/ — simple framework-free PSR-16 file cache implementation │ │ ├── Laravel/ — Laravel middleware │ │ │ └── .. │ │ ├── Symfony/ — Symfony middleware │ │ │ └── .. │ │ ├── TelegramIpValidator — Validate Telegram Bot Webhook by IP ranges │ │ └── AutoSecretByTokenService — Validate Telegram Bot Webhook by secret(auto secret by default) │ ├── TgApiResponse — Regular Telegram Response format │ ├── TgApiWebhookHandler — framework-free Response Processor for controller │ └── TgBotApiReturnParser — ^^^^^^^ is need to union ├── TgApi/ — Autogenerated DTO and Enum. Try to not edit. It will auto-re-generated │ ├── Methods/ — Autogenerated DTO and Enum for Methods │ ├── Types/ — Autogenerated DTO and Enum for Types │ └── TgApiEntityScopeEnum — Discovery of TelegramScope (Methods|Types) with all AutoGenerated DTO List ├── TgApiServices/ — Services for DTO │ ├── TgApiDTOMapper — Map Raw(array) Telegram Types/Methods to DTO │ ├── TgApiProperty — data schema for TgApiDTOContract::tgPropertyMetas │ ├── TgEntityNamer — Simple helper to return nname of user|chat|etc │ ├── TgEntityToDTORegistry — Registry of TgEntity(original terlegram name) to DTO. Can be registered Outaside of TelegramBot Lib │ └── TgEntityToDTORegistryFactory — Factory of TgEntityToDTORegistry ├── TypeDTOProcessor/ — Processors with Resistry to process incoming returns with TypeDTOContracts │ ├── Processors/ — Default Processods │ │ └── .. │ └── TypeDTOProcessorRegistry — Registry for Processors By TgApiTypeDTO ├── Wrappers/ — Wrappers for Framework-free code │ ├── TgBotCacheWrapper — Cache Wrapper │ └── TgBotLogWrapper — Logger Wrapper └── TelegramBotServiceProvider — Laravel ServiceProvider (optional)


All versions of telegram-bot-lib with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
psr/container Version ^2.0
bagart/async-kernel Version *
bagart/ask-client Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bagart/telegram-bot-lib contains the following files

Loading the files please wait ...