jove/async-php-bot

There is no license information available for the latest version (v1.0.0) of this package.

v1.0.0 2022-08-29 20:09 UTC

This package is auto-updated.

Last update: 2024-11-29 06:30:01 UTC


README

Create your own Telegram API bot asynchronously in PHP

How to use

Installation

  • Install with git
git clone https://github.com/botify-framework/botify 

Then composer install

  • Install with composer
composer create-project --prefer-dist botify-framework/botify 

Note You must install the framework directly as a master project

Webhook mode

use Botify\Events\Handler;
use Botify\TelegramAPI;

require_once __DIR__ .'/bootstrap/app.php';

$bot = new TelegramAPI([
    'token' => '123456789:AAABBBCCCDDDEEE',
]);

$bot->loopAndHear(Handler::UPDATE_TYPE_WEBHOOK);

Http server mode

use Botify\Events\Handler;
use Botify\TelegramAPI;

require_once __DIR__ .'/bootstrap/app.php';

$bot = new TelegramAPI([
    'token' => '123456789:AAABBBCCCDDDEEE',
]);

$bot->loopAndHear(Handler::UPDATE_TYPE_SOCKET_SERVER);

Long polling mode

use Botify\Events\Handler;
use Botify\TelegramAPI;

require_once __DIR__ .'/bootstrap/app.php';

$bot = new TelegramAPI([
    'token' => '123456789:AAABBBCCCDDDEEE',
]);

$bot->loopAndHear(Handler::UPDATE_TYPE_POLLING);

Support group