Skip to content

Commit 224f71b

Browse files
committed
Move code to PHP Telegram Bot namespace and adjust all links.
Remove Laravel dependency.
1 parent 1887062 commit 224f71b

12 files changed

+1925
-287
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
.idea
1+
/.idea
2+
/composer.phar
3+
/vendor/
4+
/phpunit.xml

README.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
1-
# Telegram Bot Pagination
1+
# Telegram Bot Inline Keyboard Pagination
22

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]
810

911
- [Installation](#installation)
1012
- [Composer](#composer)
1113
- [Usage](#usage)
1214
- [Test Data](#test-data)
1315
- [How To Use](#how-to-use)
1416
- [Result](#result)
17+
- [Code Quality](#code-quality)
1518
- [License](#license)
1619

1720
## Installation
1821

1922
### Composer
2023
```bash
21-
composer require "lartie/telegram-bot-pagination:^1.0.0"
24+
composer require php-telegram-bot/inline-keyboard-pagination:^1.0.0
2225
```
2326

2427
## Usage
2528

2629
### Test Data
2730
```php
28-
$items = range(1, 100);
31+
$items = range(1, 100);
2932
$command = 'testCommand'; // optional. Default: pagination
30-
$selectedPage = 10; // optional. Default: 1
33+
$selectedPage = 10; // optional. Default: 1
3134
```
3235

3336
### How To Use
3437
```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# >');
3941

40-
$pagination = $cqPagination->pagination($selectedPage); //$cqPagination->setSelectedPage($selectedPage);
41-
42+
$pagination = $ikp->pagination($selectedPage); //$ikp->setSelectedPage($selectedPage);
4243
```
4344

4445
### Result
4546
```php
4647
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
4950
...
50-
51+
5152
$response = [
5253
'reply_markup' => json_encode([
5354
'inline_keyboard' => [
@@ -60,11 +61,33 @@ if (!empty($paginate['keyboard'])) {
6061

6162
## Code Quality
6263

63-
Run the PHPUnit tests with PHPUnit.
64-
65-
phpunit tests/
64+
Run the PHPUnit tests via Composer script.
6665

66+
```bash
67+
composer test
68+
```
6769

6870
## License
6971

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"

composer.json

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,59 @@
11
{
2-
"name": "lartie/telegram-bot-pagination",
3-
"description": "Telegram Bot Pagination ",
4-
"keywords": ["laravel", "telegram api", "telegram", "pagination", "telegram-callback", "telegram bot"],
2+
"name": "php-telegram-bot/inline-keyboard-pagination",
53
"type": "library",
6-
"homepage": "https://github.com/lartie/telegram-bot-pagination",
4+
"description": "PHP Telegram Bot InlineKeyboard Pagination",
5+
"keywords": ["telegram", "bot", "inline", "keyboard", "pagination", "callback", "query"],
76
"license": "MIT",
7+
"homepage": "https://github.com/php-telegram-bot/inline-keyboard-pagination",
8+
"support": {
9+
"issues": "https://github.com/php-telegram-bot/inline-keyboard-pagination/issues",
10+
"source": "https://github.com/php-telegram-bot/inline-keyboard-pagination"
11+
},
812
"authors": [
13+
{
14+
"name": "Armando Lüscher",
15+
"email": "armando@noplanman.ch",
16+
"homepage": "https://noplanman.ch",
17+
"role": "Developer"
18+
},
919
{
1020
"name": "Artie",
1121
"email": "log.wil.log@gmail.com",
12-
"homepage": "https://github.com/lartie"
22+
"homepage": "https://github.com/lartie",
23+
"role": "Original developer"
1324
}
1425
],
1526
"require": {
16-
"php": ">=7.0"
27+
"php": "^7.0"
1728
},
1829
"require-dev": {
19-
"phpunit/phpunit": "^4.8 || ^5.0",
20-
"phpspec/prophecy": "^1.5"
30+
"jakub-onderka/php-parallel-lint": "^0.9.2",
31+
"phpunit/phpunit": "^6.1",
32+
"squizlabs/php_codesniffer": "^2.9"
2133
},
2234
"autoload": {
2335
"psr-4": {
24-
"LArtie\\TelegramBotPagination\\": "src"
36+
"TelegramBot\\InlineKeyboardPagination\\": "src"
2537
}
2638
},
2739
"autoload-dev": {
2840
"psr-4": {
29-
"LArtie\\TelegramBotPagination\\Tests\\": "tests/"
41+
"TelegramBot\\InlineKeyboardPagination\\Tests\\": "tests"
3042
}
3143
},
3244
"scripts": {
33-
"test": "phpunit"
45+
"check-code": [
46+
"vendor/bin/parallel-lint . --exclude vendor",
47+
"vendor/bin/phpcs src/ tests/ -snp --standard=psr2 --encoding=utf-8 --report-width=150"
48+
],
49+
"test": [
50+
"vendor/bin/phpunit"
51+
],
52+
"test-cov": [
53+
"vendor/bin/phpunit --coverage-clover=clover.xml"
54+
],
55+
"test-cov-upload": [
56+
"curl -s https://codecov.io/bash | bash"
57+
]
3458
}
3559
}
36-

0 commit comments

Comments
 (0)