2017 © Pedro Peláez
 

library telegramapi

A PHP Wrapper for the Telegram Bot Api

image

whitebock/telegramapi

A PHP Wrapper for the Telegram Bot Api

  • Tuesday, January 16, 2018
  • by Whitebock
  • Repository
  • 3 Watchers
  • 7 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Telegram BotApi

A PHP Wrapper for the Telegram Bot Api
Currently being refactored, see the latest releases for a stable version., (*1)

Donate on PayPal Using PHP Version 7.1, (*2)

Todo

  • [ ] Bot Api 3.2
  • [ ] Complete send functions
  • [ ] Add group administration
  • [ ] Inline mode
  • [ ] Games

Installation

Composer

When using composer you can just require this library: composer require whitebock/telegramapi, (*3)

Manual

Manual installation without composer is being worked on., (*4)

Demo

Set your token from @BotFather in the constructor., (*5)

use Whitebock\TelegramApi\Bot;
use Whitebock\TelegramApi\Photo;

$bot = new Bot('');

$me = $bot->getMe();
echo $me->getUsername().PHP_EOL;

$updates = $bot->getUpdates();
foreach ($updates as $update) {
    $chat = $update->getMessage()->getChat();
    echo $chat->getUsername().': '.$update->getMessage()->getText().PHP_EOL;
    $bot->sendMessage($chat, 'Hello World');
    $bot->sendChatAction($chat, 'upload_photo');
    $bot->sendMedia($chat, Photo::fromFile('test/bird.jpg'));
    $bot->sendLocation($chat, 52.520038, 13.404799);
    $bot->sendContact($chat,'+49123456789', 'John');
    $bot->sendVenue($chat, 51.496797, 7.455505, 'Westfalenhallen', 'Rheinlanddamm 200, 44139 Dortmund');
}

Changelog

All notable changes to this project will be documented here., (*6)

The format is based on Keep a Changelog and this project adheres to Semantic Versioning., (*7)

[Unreleased]

[1.3.0]

Added

  • Composer files
  • Namespaces
  • Getters & Fluent Setters
  • Method: callApi
  • Method: getUpdate
  • Method: sendMedia
  • Typehinting
  • Added StickerSet.php in new /Sticker/ Namespace
  • Added MaskPosition.php in new /Sticker/ Namespace
  • Added ApiException.php in new /exception/ Namespace
  • Copyright Header, better documentation

Changed

  • Switched from private to protected variables
  • Changed deserialization from parseClass to symfony

Removed

  • PhpDoc version annotation
  • PhpDoc package annotation
  • Method: sendPOSTRequest
  • Replaced sendPhoto
  • Replaced sendAudio
  • Replaced sendDocument
  • Replaced sendSticker
  • Replaced sendVideo
  • Replaced sendVoice

[1.2.0]

Added

  • class.chatmember.php
  • class.responseparameters.php

Changed

  • full phpDoc comments

Removed

  • closing php tag in pure php files

[1.1.0]

Added

  • class.bot.php
    • getUserProfilePhotos
    • getFile
  • class.file.php
    • download
    • downloadTo

[1.0.0]

Added

  • support for api 2.0
  • all send functions

[0.9.0]

Added

  • universal constructor
  • class.bot.php
    • sendSticker

[0.8.0]

Added

  • phpdoc comments
  • class.bot.php
    • serializePOSTData
    • sendPhoto
    • sendChatAction

Changed

  • inc.init.php renamed to api.telegram.php
  • class.bot.php
    • sendMessage

[0.7.0]

Added

  • class.bot.php
    • setWebhook
    • sendMessage

Changed

  • inc.init.php
    • parseClass

[0.6.0]

Added

  • inc.init.php
  • class.bot.php
    • sendPostRequest
    • getMe
    • getUpdates

[0.5.0]

Added

  • class.bot.php
  • class.message.php

[0.4.0]

Added

  • class.audio.php
  • class.chat.php
  • class.contact.php
  • class.document.php
  • class.file.php
  • class.forcereply.php
  • class.location.php
  • class.message.php
  • class.photosize.php
  • class.replykeyboardhide.php
  • class.replykeyboardmarkup.php
  • class.sticker.php
  • class.update.php
  • class.user.php
  • class.userprofilephotos.php
  • class.video.php
  • class.voice.php

The Versions

16/01 2018

dev-master

9999999-dev

A PHP Wrapper for the Telegram Bot Api

  Sources   Download

MIT

The Requires

 

by Sven Drewniok

16/01 2018

1.3.0

1.3.0.0

A PHP Wrapper for the Telegram Bot Api

  Sources   Download

MIT

The Requires

 

by Sven Drewniok