PHPackages                             seblhaire/bootstrappaginator - 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. [Search &amp; Filtering](/categories/search)
4. /
5. seblhaire/bootstrappaginator

ActiveLibrary[Search &amp; Filtering](/categories/search)

seblhaire/bootstrappaginator
============================

A Laravel library to generate paginations

1.4.0(3mo ago)338MITPHPPHP &gt;=8.4

Since Oct 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/seblhaire/bootstrappaginator)[ Packagist](https://packagist.org/packages/seblhaire/bootstrappaginator)[ Docs](https://github.com/seblhaire/bootstrappaginator)[ RSS](/packages/seblhaire-bootstrappaginator/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (2)Versions (18)Used By (0)

Bootstrap Paginator
===================

[](#bootstrap-paginator)

[By Sébastien L'haire](http://sebastien.lhaire.org)

A Laravel library to generate paginations with [Bootstrap](https://getbootstrap.com/) 4 or 5 CSS Framework.

This library provides two different paginators:

- a classical paginator with page numbers and previous and next button. [![paginator image](paginator.png)](paginator.png)
- an alphabetical paginator with letters [![paginator alpha image](paginatoralpha.png)](paginatoralpha.png)

Both paginators can be used in same page.

Demo site available [here](https://sebastien.lhaire.org/paginator).

Installation
============

[](#installation)

1. `composer require seblhaire/bootstrappaginator`
2. Optionally install Boostrap using `npm install bootstrap`
3. Composer will automatically link the package with Laravel. But you still can explicitely add provider and facade to your `config/app.php`:

```
  'providers' => [
    ...
      Seblhaire\BootstrapPaginator\BootstrapPaginatorServiceProvider::class,
      ...
    ],
    'aliases' => [
        ...
        'BootstrapPaginator' => Seblhaire\BootstrapPaginator\BootstrapPaginator::class,
      ]
```

4. Publish package (optionally).

```
$ php artisan vendor:publish
```

5. Add a translation to Laravel existing `pagination.php` translation file in directory `resources/lang/en/`. Simply add key:

```
'all' => 'All',

```

Usage
=====

[](#usage)

Declare Facade in Controller headers:

```
 use Seblhaire\BootstrapPaginator\BootstrapPaginator;

```

Your route must contain a parameter for page in last segment:

```
Route::get('/issues/{page?}', 'MainController@issues')->name('issues');

```

Eg: you can have a route `https://test.site/issues/9`, route `https://test.site/issues` should display page 1. Controller method can be declared like this:

```
function issues($page = 1){ ...}

```

If you include paginator alpha, last segment will be an initial:

```
Route::get('/authors/{initial?}', 'MainController@authors')->name('authors');

```

Eg: you can have a route `https://test.site/authors/D` would display all authors beginning with D. `https://test.site/authors` will display all items. Controller method can be declared like this:

```
public function authors($initial = config('bootstrappaginator.valueforall')){ ... }

```

You can combine both paginators in a single page. In this case, initial will be in the before last position and page parameter in the last position:

```
Route::get('/authors/{initial?}/{page?}', 'MainController@authors')->name('authors');

```

In this case `https://test.site/authors` displays first page of all items. `https://test.site/authors/all/3` will display third page of all items. `https://test.site/authors/D` will display first page of items beginning with D. And `https://test.site/authors/D/3` will display third page of items beginning with D. Initialize your method with default parameters and use them in your code:

```
public function authors($initial = null, $page =1){
  ....
   $initial = is_null($initial) ? config('bootstrappaginator.valueforall') : $initial;
   $route = 'authors';
   $options = ['nbpages' => 4, 'params' => ['initial' => $initial]];
   $optionalpha = ['type' => 'alpha'];
   $paginator = BootstrapPaginator::init($page, $route, $options);
   $paginatoralpha = BootstrapPaginator::init($initiale, $route, $optionalpha);
   ....
   return view('pages.authors', [
       ...
       'paginator' => $paginator,
       'paginatoralpha' => $paginatoralpha,
       ...
  ]);
}

```

In this example, numeric paginator will contain current initial in the link urls. Alpha paginator's links will direct web page users to the first page with the initial they contain. Then in the view, print your paginator like this:

`{!! $paginator->render() !!}`

or simply

`{!! $paginator !!}`

Parameters
----------

[](#parameters)

- `$page` : current page number or initial letter;
- `$route`: current route id;
- `$options` : array of values to replace default values in config file:
    - `type`: either `numeric` or `alpha`;
    - `params` : default `[]`. Array of parameters used by `route()` helper to issue urls in paginator. See above examples;
    - `getparams` : default `[]`. GET parameters that will be added to path. Eg: `['search' => 'dummy', 'type' => 'global']` will be translated into `url?search=dummy&type=global`
    - numeric paginator specific parameters:
        - `pageparam` : default `page`. Id of page parameter in route.
        - `nbpages`: Default 1. Number of pages that will be displayed.
        - `withoutdots`: default `false`. Display all pages without spacing ranges by dots;
        - `max_pages_without_dots`: default `9`. Maximum number of pages without dot separation.
        - `items_before_after_current`: default `2`. Number of pages to display before and after page item.
    - alpha paginator specific parameters:
        - `initialparam`: default `initial`. Id of initial parameter in route;
        - `valueforall` : delault `all`. Value used to display all items instead of items beginnig with a certain parameter.
    - `class`: default `pagination justify-content-center`. Class of `` surrounding pagination.
    - `itemclass`: default `page-item`. Class of `` element.
    - `linkclass`: default `page-link`. Class of `` element.
    - `activelink`: default ` active`. Class added to current element.
    - `disabledlink`: default ` disabled`. Class of disabled button.
    - `srcurrent` default: ` (current)`- Element added to current element for speech aid tools.
    - `previousbuttoncontent`: default `&laquo;`. Content for previous button.
    - `nextbuttoncontent`: default `&raquo;`. Content for next button.

Config files
------------

[](#config-files)

Config files are available, either in package directory in vendor\\seblhaire/bootstrappaginator or in your app config directory if you publish config.

```
config('bootstrappaginator')
```

Questions? Contributions?
=========================

[](#questions-contributions)

Feel free to send feature requests or merge request to the author or simply to ask questions.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance82

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 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 ~142 days

Recently: every ~274 days

Total

15

Last Release

93d ago

PHP version history (3 changes)1.0PHP &gt;=5.6

1.3.1PHP &gt;=8.2

1.4.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/72663124?v=4)[Sébastien L'haire](/maintainers/seblhaire)[@seblhaire](https://github.com/seblhaire)

---

Top Contributors

[![seblhaire](https://avatars.githubusercontent.com/u/72663124?v=4)](https://github.com/seblhaire "seblhaire (30 commits)")

---

Tags

bootstrap-paginatorlaravel-packagepaginatorpaginator-alpha

### Embed Badge

![Health badge](/badges/seblhaire-bootstrappaginator/health.svg)

```
[![Health](https://phpackages.com/badges/seblhaire-bootstrappaginator/health.svg)](https://phpackages.com/packages/seblhaire-bootstrappaginator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M145](/packages/laravel-mcp)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)[spatie/laravel-site-search

A site search engine

309136.6k](/packages/spatie-laravel-site-search)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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