malvik-lab / telegram-sender
1.0.0
2022-12-26 19:54 UTC
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- fakerphp/faker: ^1.9.1
- opis/json-schema: 2.x-dev
- phpunit/phpunit: 10.0.x-dev
README
Simple library to use the official Telegram API.
Available methods
- getMe
- sendMessage
- sendPhoto
- sendLocation
- sendDocument
Installation (with Composer)
composer require malvik-lab/telegram-sender
Use
<?php require 'vendor/autoload.php'; use GuzzleHttp\Client; use MalvikLab\TelegramSender\TelegramSender; $telegramSender = new TelegramSender('YOUR_BOT_KEY', new Client()); $telegramSender->sendMessage('CHAT_ID', 'Message'); $telegramSender->sendPhoto('CHAT_ID', 'PHOTO', 'Caption'); // PHOTO: image path or external url $telegramSender->sendLocation('CHAT_ID', 'LATITUDE', 'LONGITUDE'); $telegramSender->sendDocument('CHAT_ID', 'DOCUMENT', 'Caption'); // DOCUMENT: document path or external url
Running Test
BOT_KEY=yourBotKey CHAT_ID=yourChatId vendor/bin/phpunit tests/integration --testdox