mateodioev / tgbot
Libreria para interactuar con los metodos de la api de bots de telegram
v4.7.7
2026-01-12 13:40 UTC
Requires
- php: >=8.2
- ext-curl: *
- ext-fileinfo: *
- amphp/amp: ^3.0
- amphp/byte-stream: ^2.1
- amphp/file: ^3.0
- amphp/http-client: ^v5.0
- mateodioev/request: ^2.0
- mateodioev/utils: ^1.1
- vlucas/phpdotenv: ^5.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.84
- mateodioev/php-easy-cli: *
- phpunit/phpunit: ^9.5
- dev-main
- v4.x-dev
- v4.7.7
- v4.7.6
- v4.7.5
- v4.7.4
- v4.7.3
- v4.7.2
- v4.7.1
- v4.7.0
- v4.6.6
- v4.6.5
- v4.6.4
- v4.6.3
- v4.6.2
- v4.6.1
- v4.6.0
- v4.5.0
- v4.4.5
- v4.4.4
- v4.4.3
- v4.4.2
- v4.4.1
- v4.4
- v4.3.6
- v4.3.5
- v4.3.4.1
- v4.3.4-beta
- v4.3.3
- v4.3.2
- v4.3.1
- v4.3.0
- v4.2.2
- v4.2.1
- v4.2.0-beta2
- v4.2.0-beta
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0-beta3
- v4.0.0-beta2
- v4.0.0-beta1
- v4.0.0-beta
- v3.x-dev
- v3.6.0
- v3.5.12
- v3.5.11
- v3.5.6
- v3.5.5
- v3.5.4
- v3.5.3
- v3.5.2.1
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.3
- v3.4.2.1
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2
- v3.1
- v3.0.1
- v3.0
- v3.0-beta
- v2.0.1
- v2.0
- v1.2.2
- v1.2.1
- v1.2
- v1.1.2
- v1.1.1
- v1.1
- v1.0
- dev-v4-powerfull_constructors
This package is auto-updated.
Last update: 2026-03-12 14:14:21 UTC
README
Install
composer require mateodioev/tgbot
git clone https://github.com/Mateodioev/tgbot
First step
require __DIR__ . 'path/to/vendor/autoload.php';
Create new Api instance
use Mateodioev\Bots\Telegram\Api;
$api = new Api($bot_token);
Send method to telegram api
use Mateodioev\Bots\Telegram\Types\Message;
$message = $api->sendMessage('chat_id', 'Text', $others_params);
var_dump($message->get());
var_dump($message instanceof Message::class);
Enable async mode
Note: This use amphp/http-client
$api->setAsync(true);
Create new telegram types
use Mateodioev\Bots\Telegram\Types\baseType;
class MyCustomType extends baseType
{
protected array $fields = [
'field1' => 'valueType',
'id' => 'integer', // only accept integer values
'user' => User::class, // only accept arrays or instances of the User class
];
}
Create new instance
// from array
$customType = MyCustomType::createFromArray(['field1' => 'Type', 'id' => 1111, 'user' => $user]);
// From stdClass
$customType = MyCustomType::create((object) ['field1' => 'Type', 'id' => 1111, 'user' => $user]);
// Create from constructor
$customType = new MyCustomType(field1: 'Type', id: 1111, user: $user); // maybe this cause linter errors