PHPackages                             php-telegram-bot/inline-keyboard-pagination - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. php-telegram-bot/inline-keyboard-pagination

ActiveLibrary

php-telegram-bot/inline-keyboard-pagination
===========================================

PHP Telegram Bot InlineKeyboard Pagination

1.1.0(4y ago)298.8k↓50%11[2 issues](https://github.com/php-telegram-bot/inline-keyboard-pagination/issues)[1 PRs](https://github.com/php-telegram-bot/inline-keyboard-pagination/pulls)1MITPHPPHP ^7.4|^8.0

Since Sep 8Pushed 4y ago5 watchersCompare

[ Source](https://github.com/php-telegram-bot/inline-keyboard-pagination)[ Packagist](https://packagist.org/packages/php-telegram-bot/inline-keyboard-pagination)[ Docs](https://github.com/php-telegram-bot/inline-keyboard-pagination)[ Fund](https://github.com/php-telegram-bot/core#donate)[ GitHub Sponsors](https://github.com/noplanman)[ RSS](/packages/php-telegram-bot-inline-keyboard-pagination/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (1)

[Telegram Bot Inline Keyboard Pagination](https://github.com/php-telegram-bot/inline-keyboard-pagination "PHP Telegram Bot Inline Keyboard Pagination on GitHub")
=================================================================================================================================================================

[](#telegram-bot-inline-keyboard-pagination)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8751d179bf5a4ae07d308a5e6e85214f159705cba9423990a8ad61ce71e1e595/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://scrutinizer-ci.com/g/php-telegram-bot/inline-keyboard-pagination/?branch=master "Code quality on Scrutinizer")[![Codecov](https://camo.githubusercontent.com/fa7314541e1ca85a3b516090eeef807240e4f02403d572108a54968ff79e068f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://codecov.io/gh/php-telegram-bot/inline-keyboard-pagination "Code coverage on Codecov")[![Build Status](https://camo.githubusercontent.com/a6a4a2980a29edde0a1d94647a6c267fb21429ba669e1a77dab845f605e75114/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://travis-ci.com/php-telegram-bot/inline-keyboard-pagination "Build status on Travis-CI")

[![Latest Stable Version](https://camo.githubusercontent.com/6c23d5b2a82cd97fbb307bc420c5cd0fce6dba2275f961dc0ca6f8c27fe66d46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://packagist.org/packages/php-telegram-bot/inline-keyboard-pagination "PHP Telegram Bot Inline Keyboard Pagination on Packagist")[![Total Downloads](https://camo.githubusercontent.com/7e93ac874902624594a0cc0308d7bfbf0eae771866366e7d73d1051d7db9991b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://packagist.org/packages/php-telegram-bot/inline-keyboard-pagination "PHP Telegram Bot Inline Keyboard Pagination on Packagist")[![License](https://camo.githubusercontent.com/69f935a3d74fa587aaf5aa704015d2c28b78b79a8fcd95724ee5c4a63bfff8da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068702d74656c656772616d2d626f742f696e6c696e652d6b6579626f6172642d706167696e6174696f6e2e737667)](https://github.com/php-telegram-bot/inline-keyboard-pagination/blob/master/LICENSE "PHP Telegram Bot Inline Keyboard Pagination license")

- [Installation](#installation)
    - [Composer](#composer)
- [Usage](#usage)
    - [Test Data](#test-data)
    - [How To Use](#how-to-use)
- [Code Quality](#code-quality)
- [License](#license)

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require php-telegram-bot/inline-keyboard-pagination
```

Usage
-----

[](#usage)

### Test Data

[](#test-data)

```
$items        = range(1, 100); // required.
$command      = 'testCommand'; // optional. Default: pagination
$selectedPage = 10;            // optional. Default: 1
$labels       = [              // optional. Change button labels (showing defaults)
    'default'  => '%d',
    'first'    => '« %d',
    'previous' => '‹ %d',
    'current'  => '· %d ·',
    'next'     => '%d ›',
    'last'     => '%d »',
];

// optional. Change the callback_data format, adding placeholders for data (showing default)
$callbackDataFormat = 'command={COMMAND}&oldPage={OLD_PAGE}&newPage={NEW_PAGE}'
```

### How To Use

[](#how-to-use)

```
// Define inline keyboard pagination.
$ikp = new InlineKeyboardPagination($items, $command);
$ikp->setMaxButtons(7, true); // Second parameter set to always show 7 buttons if possible.
$ikp->setLabels($labels);
$ikp->setCallbackDataFormat($callbackDataFormat);

// Get pagination.
$pagination = $ikp->getPagination($selectedPage);

// or, in 2 steps.
$ikp->setSelectedPage($selectedPage);
$pagination = $ikp->getPagination();
```

Now, `$pagination['keyboard']` is basically a row that contains the pagination.

```
// Use it in your request.
if (!empty($pagination['keyboard'])) {
    //$pagination['keyboard'][0]['callback_data']; // command=testCommand&oldPage=10&newPage=1
    //$pagination['keyboard'][1]['callback_data']; // command=testCommand&oldPage=10&newPage=7

    ...
    $data['reply_markup'] = [
        'inline_keyboard' => [
            $pagination['keyboard'],
        ],
    ];
    ...
}
```

To get the callback data, you can use the provided helper method (only works when using the default callback data format):

```
// e.g. Callback data.
$callback_data = 'command=testCommand&oldPage=10&newPage=1';

$params = InlineKeyboardPagination::getParametersFromCallbackData($callbackData);

//$params = [
//    'command' => 'testCommand',
//    'oldPage' => '10',
//    'newPage' => '1',
//];

// or, just use PHP directly if you like. (literally what the helper does!)
parse_str($callbackData, $params);
```

Code Quality
------------

[](#code-quality)

Run the PHPUnit tests via Composer script.

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/php-telegram-bot/inline-keyboard-pagination/blob/master/LICENSE "PHP Telegram Bot Inline Keyboard Pagination license") for more information.

Project based on [Telegram Bot Pagination](https://github.com/lartie/Telegram-Bot-Pagination "Telegram Bot Pagination by Lartie on GitHub") by [lartie](https://github.com/lartie "Lartie on GitHub").

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1401 days

Total

2

Last Release

1773d ago

PHP version history (2 changes)1.0.0PHP ^7.0

1.1.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c5a5651780b63b8f70c9a4ac0c476b8ccf9042e2cfcc8f55aa669c71682f72e?d=identicon)[noplanman](/maintainers/noplanman)

![](https://www.gravatar.com/avatar/e7ff8761fd0f3c0ecd77e009b9984ac34a247533221fb8c546421f05300f5769?d=identicon)[Tii](/maintainers/Tii)

---

Top Contributors

[![noplanman](https://avatars.githubusercontent.com/u/9423417?v=4)](https://github.com/noplanman "noplanman (22 commits)")

---

Tags

callbackinlinepaginationphp7php8querytelegramtelegram-botpaginationquerycallbackbottelegraminlinekeyboard

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/php-telegram-bot-inline-keyboard-pagination/health.svg)

```
[![Health](https://phpackages.com/badges/php-telegram-bot-inline-keyboard-pagination/health.svg)](https://phpackages.com/packages/php-telegram-bot-inline-keyboard-pagination)
```

###  Alternatives

[longman/telegram-bot

PHP Telegram bot

4.0k2.1M50](/packages/longman-telegram-bot)[telegram-bot/api

PHP Wrapper for Telegram Bot API

1.2k2.4M29](/packages/telegram-bot-api)[nutgram/nutgram

The Telegram bot library that doesn't drive you nuts

714214.9k8](/packages/nutgram-nutgram)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[tg-bot-api/bot-api-base

Clear and simple Telegram bot API

22278.8k2](/packages/tg-bot-api-bot-api-base)[botman/driver-telegram

Telegram driver for BotMan

92437.3k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
