Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit c89e215

Browse files
committed
Documentation format
1 parent b6405ad commit c89e215

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This is a complete PHP7 bot API implementation for Telegram.
1212
About this class
1313
--------
1414

15-
* Enables you to send messages, stickers, location and other methods via PHP to Telegram.
15+
* Enables you to send messages, stickers, location and other methods via PHP a Telegram user (or group).
1616
* Respects and implements the default types and methods made by Telegram itself.
1717
* Doesn't need any dependency, except for Guzzle. I'm working on an implementation that doesn't require Guzzle as well.
1818
* Inline bots support!
@@ -38,25 +38,25 @@ Installation
3838

3939
The preferred method is composer, so add the following to your composer.json:
4040

41-
<pre>
41+
```json
4242
{
4343
"require": {
4444
"unreal4u/telegram-api": "~1.0"
4545
}
4646
}
47-
</pre>
47+
```
4848

4949
Basic usage
5050
----------
5151

52-
<pre>
52+
```php
5353
$sendMessage = new SendMessage();
5454
$sendMessage->chat_id = A_USER_CHAT_ID;
5555
$sendMessage->text = 'Hello world!';
5656

5757
$tgLog = new TgLog(BOT_TOKEN);
5858
$message = $tgLog->performApiRequest($sendMessage);
59-
</pre>
59+
```
6060

6161
With the SendMessage() object, you can create a message to be sent through the TelegramLog object.
6262
All other functionality is based upon this behaviour, so every other method is very similar: you instantiate an object,
@@ -70,19 +70,19 @@ Getting updates via Webhook
7070

7171
The first thing you'll have to do is register a webhook with Telegram via the SetWebhook method:
7272

73-
<pre>
73+
```php
7474
$setWebhook = new SetWebhook();
7575
$setWebhook->url = '[YOUR HTTPS URL]';
7676

7777
$tgLog = new TgLog(BOT_TOKEN);
7878
$tgLog->performApiRequest($setWebhook);
79-
</pre>
79+
```
8080

8181
This will leave you prepared to start receiving updates on the chosen URL:
8282

83-
<pre>
83+
```php
8484
$update = new Update($_POST);
85-
</pre>
85+
```
8686

8787
Now <code>$update</code> will contain the actual Update object. Hope that wasn't too difficult :)
8888

@@ -106,7 +106,7 @@ you are required to send back (so that Telegram knows what to display to which u
106106

107107
The following example code should help you a lot with this:
108108

109-
<pre>
109+
```php
110110
$update = new Update($_POST);
111111

112112
if (!empty($update->inline_query)) {
@@ -122,7 +122,7 @@ if (!empty($update->inline_query)) {
122122
$tgLog = new TgLog(BOT_TOKEN);
123123
$result = $tgLog->performApiRequest($answerInlineQuery);
124124
}
125-
</pre>
125+
```
126126

127127
A functional example can be found in a [working implementation](https://github.com/unreal4u/tg-timebot).
128128

@@ -146,6 +146,9 @@ But I wanted to study a bunch of new concepts for me and make a standalone clien
146146
I had heard of all these great tools previously but I didn't have a nice project to work on and learn properly. So this
147147
project was born.
148148

149+
At the same time, I wanted an API that did respect Telegram's API model as much as possible, while being friendly to a
150+
developer as well. The result of that is this package, check the examples for usage.
151+
149152
Extra requirements
150153
----------
151154

@@ -165,7 +168,7 @@ that there are some caveats on this, so you may be better out with the SetWebhoo
165168
Semver
166169
-----------
167170

168-
I will try my best to respect Semantic Versioning.
171+
I will try my best to respect [Semantic Versioning](http://semver.org).
169172
That being said, the first stable release is v1.0.0, from there on no mayor BC changes will occur unless we update
170173
the major.
171174

@@ -177,21 +180,28 @@ out).
177180

178181
Instructions
179182

180-
1- Clone this repo
183+
* Clone this repo
181184

182-
2- Execute:
183-
<pre>
185+
* Execute:
186+
```bash
184187
vagrant up # Might take a while :)
185188
vagrant ssh
186189
cd /var/www/default/
187190
composer install -o
188-
</pre>
191+
```
189192

190-
3- To unit test:
191-
<pre>
193+
* To unit test:
194+
```bash
192195
vagrant ssh
193196
cd /var/www/default/
194197
vendor/bin/phpunit
195-
</pre>
198+
```
199+
200+
* To unit test with code coverage:
201+
```bash
202+
vagrant ssh
203+
cd /var/www/default/
204+
./execute-tests.sh
205+
```
196206

197-
4- That's all folks!
207+
* That's all folks!

0 commit comments

Comments
 (0)