1
- # Telegram Bot Pagination
1
+ # Telegram Bot Inline Keyboard Pagination
2
2
3
- [ ![ Latest Stable Version] ( https://poser.pugx.org/lartie/telegram-bot-pagination/v/stable )] ( https://packagist.org/packages/lartie/telegram-bot-pagination )
4
- [ ![ Total Downloads] ( https://poser.pugx.org/lartie/telegram-bot-pagination/downloads )] ( https://packagist.org/packages/lartie/telegram-bot-pagination )
5
- [ ![ Latest Unstable Version] ( https://poser.pugx.org/lartie/telegram-bot-pagination/v/unstable )] ( https://packagist.org/packages/lartie/telegram-bot-pagination )
6
- [ ![ License] ( https://poser.pugx.org/lartie/telegram-bot-pagination/license )] ( https://packagist.org/packages/lartie/telegram-bot-pagination )
7
- [ ![ composer.lock] ( https://poser.pugx.org/lartie/telegram-bot-pagination/composerlock )] ( https://packagist.org/packages/lartie/telegram-bot-pagination )
3
+ [ ![ Scrutinizer Code Quality] [ code-quality-badge ]] [ code-quality ]
4
+ [ ![ Codecov] [ code-coverage-badge ]] [ code-coverage ]
5
+ [ ![ Build Status] [ build-status-badge ]] [ build-status ]
6
+
7
+ [ ![ Latest Stable Version] [ latest-version-badge ]] [ github-tgbot-ikp ]
8
+ [ ![ Total Downloads] [ total-downloads-badge ]] [ packagist-tgbot-ikp ]
9
+ [ ![ License] [ license-badge ]] [ license ]
8
10
9
11
- [ Installation] ( #installation )
10
12
- [ Composer] ( #composer )
11
13
- [ Usage] ( #usage )
12
14
- [ Test Data] ( #test-data )
13
15
- [ How To Use] ( #how-to-use )
14
16
- [ Result] ( #result )
17
+ - [ Code Quality] ( #code-quality )
15
18
- [ License] ( #license )
16
19
17
20
## Installation
18
21
19
22
### Composer
20
23
``` bash
21
- composer require " lartie/ telegram-bot- pagination:^1.0.0"
24
+ composer require php- telegram-bot/inline-keyboard- pagination:^1.0.0
22
25
```
23
26
24
27
## Usage
25
28
26
29
### Test Data
27
30
``` php
28
- $items = range(1, 100);
31
+ $items = range(1, 100);
29
32
$command = 'testCommand'; // optional. Default: pagination
30
- $selectedPage = 10; // optional. Default: 1
33
+ $selectedPage = 10; // optional. Default: 1
31
34
```
32
35
33
36
### How To Use
34
37
``` php
35
-
36
- $cqPagination = new CallbackQueryPagination($items, $command);
37
- $cqPagination->setMaxButtons(6);
38
- $cqPagination->setWrapSelectedButton('< #VALUE# >');
38
+ $ikp = new InlineKeyboardPagination($items, $command);
39
+ $ikp->setMaxButtons(6);
40
+ $ikp->setWrapSelectedButton('< #VALUE# >');
39
41
40
- $pagination = $cqPagination->pagination($selectedPage); //$cqPagination->setSelectedPage($selectedPage);
41
-
42
+ $pagination = $ikp->pagination($selectedPage); //$ikp->setSelectedPage($selectedPage);
42
43
```
43
44
44
45
### Result
45
46
``` php
46
47
if (!empty($paginate['keyboard'])) {
47
- $paginate['keyboard'][0]['callback_data']; // testCommand?currentPage10= &nextPage=1
48
- $paginate['keyboard'][1]['callback_data']; // testCommand?currentPage10= &nextPage=9
48
+ $paginate['keyboard'][0]['callback_data']; // testCommand?currentPage=10 &nextPage=1
49
+ $paginate['keyboard'][1]['callback_data']; // testCommand?currentPage=10 &nextPage=9
49
50
...
50
-
51
+
51
52
$response = [
52
53
'reply_markup' => json_encode([
53
54
'inline_keyboard' => [
@@ -60,11 +61,33 @@ if (!empty($paginate['keyboard'])) {
60
61
61
62
## Code Quality
62
63
63
- Run the PHPUnit tests with PHPUnit.
64
-
65
- phpunit tests/
64
+ Run the PHPUnit tests via Composer script.
66
65
66
+ ``` bash
67
+ composer test
68
+ ```
67
69
68
70
## License
69
71
70
- The MIT License (MIT). Please see [ License File] ( LICENSE.md ) for more information.
72
+ The MIT License (MIT). Please see [ License File] [ license ] for more information.
73
+
74
+ Project based on [ Telegram Bot Pagination] [ github-lartie-tbp ] by [ lartie] [ github-lartie ] .
75
+
76
+
77
+ [ github-tgbot-ikp ] : https://github.com/php-telegram-bot/inline-keyboard-pagination " PHP Telegram Bot Inline Keyboard Pagination on GitHub "
78
+ [ packagist-tgbot-ikp ] : https://packagist.org/packages/php-telegram-bot/inline-keyboard-pagination " PHP Telegram Bot Inline Keyboard Pagination on Packagist "
79
+ [ license ] : https://github.com/php-telegram-bot/inline-keyboard-pagination/blob/master/LICENSE " PHP Telegram Bot Inline Keyboard Pagination license "
80
+
81
+ [ code-quality-badge ] : https://img.shields.io/scrutinizer/g/php-telegram-bot/inline-keyboard-pagination.svg
82
+ [ code-quality ] : https://scrutinizer-ci.com/g/php-telegram-bot/inline-keyboard-pagination/?branch=master " Code quality on Scrutinizer "
83
+ [ code-coverage-badge ] : https://img.shields.io/codecov/c/github/php-telegram-bot/inline-keyboard-pagination.svg
84
+ [ code-coverage ] : https://codecov.io/gh/php-telegram-bot/inline-keyboard-pagination " Code coverage on Codecov "
85
+ [ build-status-badge ] : https://img.shields.io/travis/php-telegram-bot/inline-keyboard-pagination.svg
86
+ [ build-status ] : https://travis-ci.org/php-telegram-bot/inline-keyboard-pagination " Build status on Travis-CI "
87
+
88
+ [ latest-version-badge ] : https://img.shields.io/packagist/v/php-telegram-bot/inline-keyboard-pagination.svg
89
+ [ total-downloads-badge ] : https://img.shields.io/packagist/dt/php-telegram-bot/inline-keyboard-pagination.svg
90
+ [ license-badge ] : https://img.shields.io/packagist/l/php-telegram-bot/inline-keyboard-pagination.svg
91
+
92
+ [ github-lartie-tbp ] : https://github.com/lartie/Telegram-Bot-Pagination " Telegram Bot Pagination by Lartie on GitHub "
93
+ [ github-lartie ] : https://github.com/lartie " Lartie on GitHub "
0 commit comments