lartie/telegram-bot-pagination
Composer 安装命令:
composer require lartie/telegram-bot-pagination
包简介
Telegram Bot Pagination
README 文档
README
Installation
Composer
composer require "lartie/telegram-bot-pagination:^1.0.0"
Usage
Test Data
$items = range(1, 100); $command = 'testCommand'; // optional. Default: pagination $selectedPage = 10; // optional. Default: 1
How To Use
$cqPagination = new CallbackQueryPagination($items, $command); $cqPagination->setMaxButtons(6); $cqPagination->setWrapSelectedButton('< #VALUE# >'); $pagination = $cqPagination->pagination($selectedPage); //$cqPagination->setSelectedPage($selectedPage);
Result
if (!empty($paginate['keyboard'])) { $paginate['keyboard'][0]['callback_data']; // testCommand?currentPage10=&nextPage=1 $paginate['keyboard'][1]['callback_data']; // testCommand?currentPage10=&nextPage=9 ... $response = [ 'reply_markup' => json_encode([ 'inline_keyboard' => [ $paginate['keyboard'], ], ]), ]; }
Code Quality
Run the PHPUnit tests with PHPUnit.
phpunit tests/
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 272
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-22