Plain PHP vs Botlify Helpers: Choose and Build

Raw MD
Both approaches are PHP. Compare loading, request control, portability and maintenance.

Two approaches, one language

Telegram helpers are PHP functions, not a separate language or a different Telegram server. Plain PHP/cURL builds requests in your code. Botlify helpers build or forward those requests through the platform transport. Neither approach bypasses Telegram permissions, rate limits or file restrictions.

QuestionPlain PHP/cURLBotlify helper PHP
How do I start?Use your own request function and credentials.Call tg_all_fun(); before the first helper.
Is a helper file include required?No.No include path in hosted bot code.
Who builds requests?Your cURL/JSON code.Native shorthand or a generated API wrapper.
Who handles failures?Your code checks transport and API failures.Helpers return results; your bot still handles failures.
Can I run elsewhere?Yes, with PHP extensions, credentials and webhook configuration.The native suite depends on the Botlify runtime; moving hosts requires adaptation.
Which is faster?Depends on code, payload, network and retries.No measured speed advantage is claimed.
When should I choose it?For explicit transport control or portability.For shorter code using the platform’s provided functions.

Three helper entry points

PHP
tg_all_fun();
// Convenience: defaults to HTML.
tg_send($chatId, '<b>Hello</b>');
// Exact API method wrapper: explicit parameter array.
tg_api_send_message(['chat_id'=>$chatId, 'text'=>'Hello']);
// Generic method access.
tg_request('sendMessage', ['chat_id'=>$chatId, 'text'=>'Hello']);

These are alternatives: normally call only one to send one message. Generated wrappers accept array $params = [], ?string $token = null. Their empty default does not mean Telegram accepts missing required fields. Native shorthands have their own signatures and defaults; check the reference before switching between styles.

What tg_all_fun actually does

In hosted webhook and isolated child-cron requests, the loader registers the public helper functions once per request. Repeated calls are safe. It does not send a Telegram request. Without it, ordinary PHP continues to run but calls such as tg_send are undefined. The platform keeps internal transport available for its own operations. The PHP file can still be compiled: opt-in registration is not a zero-overhead performance guarantee.

Avoid naming collisions

Use your own distinct function name, such as demoTelegram, for custom cURL code. Do not define your own tg_send/tg_api functions and then enable the native suite. A migration must preserve each function’s expected arguments and result format.

Next steps

Copy equivalent complete bot examples · Explore all 193 API wrappers and 425 types · Loader and cron migration