PHPackages                             sinasalek/silex-pagerfanta-provider - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sinasalek/silex-pagerfanta-provider

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sinasalek/silex-pagerfanta-provider
===================================

Silex ServiceProvider for Pagerfanta Library

v1.1.0(11y ago)02062MITPHP

Since Mar 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sinasalek/silex-pagerfanta-provider)[ Packagist](https://packagist.org/packages/sinasalek/silex-pagerfanta-provider)[ Docs](https://github.com/franmomu/silex-pagerfanta-provider)[ RSS](/packages/sinasalek-silex-pagerfanta-provider/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

PagerfantaServiceProvider
-------------------------

[](#pagerfantaserviceprovider)

Provider to use [Pagerfanta](https://github.com/whiteoctober/Pagerfanta) with [Silex](https://github.com/fabpot/Silex)

This Provider is based on [WhiteOctoberPagerfantaBundle](https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle) and includes:

- Twig function to render pagerfantas with views and options.
- Way to use easily views.

#### Install

[](#install)

You have to add to your composer.json file:

```
"franmomu/silex-pagerfanta-provider": "1.0.*@dev"

```

or if you use Symfony2.2 components:

```
"franmomu/silex-pagerfanta-provider": "dev-master"

```

#### Registering

[](#registering)

```
$app->register(new FranMoreno\Silex\Provider\PagerfantaServiceProvider());

```

#### Parameters

[](#parameters)

This are the default parameters:

```
$app['pagerfanta.view.options'] = array(
    'routeName'        => null,
    'routeParams'      => array(),
    'pageParameter'    => '[page]',
    'proximity'        => 3,
    'next_message'     => '&raquo;',
    'previous_message' => '&laquo;',
    'default_view'     => 'default'
);

```

#### Rendering pagination

[](#rendering-pagination)

The Twig Extension provides this function:

```
{{ pagerfanta(my_pager, view_name, view_options) }}

```

The routes are generated automatically for the current route using the variable "page" to propagate the page number. By default, the bundle uses the *DefaultView* with the *default* name.

```
{{ pagerfanta(my_pager) }}

```

If you want to use a custom template, add another argument

```

    {{ pagerfanta(my_pager, 'my_template') }}

```

With Options

```
{{ pagerfanta(my_pager, 'default', { 'proximity': 2}) }}

```

See the Pagerfanta documentation for the list of the parameters.

#### Adding a custom template

[](#adding-a-custom-template)

You can use the CSS classes provided with DefaultView, but if you want to create a Custom View, you have to implement `Pagerfanta\View\ViewInterface`, then add the View to the Factory:

```
$app['pagerfanta.view_factory'] = $app->share($app->extend('pagerfanta.view_factory', function($viewFactory, $app) {
    $customView = new \Foo\Bar\View\CustomView();
    $viewFactory->add(array(
        'my_view' => $customView
    ));

    return $viewFactory;
}));

```

And if you want set as default view:

```
$app['pagerfanta.view.options'] = array(
    'default_view'  => 'my_view'
);

```

#### Use in controllers

[](#use-in-controllers)

```
use Pagerfanta\Pagerfanta;
use Pagerfanta\Adapter\ArrayAdapter;

$app->get('/index', function (Request $request) use ($app) {

    $results = $app['some.service']->getResults();

    $adapter = new ArrayAdapter($results);
    $pagerfanta = new Pagerfanta($adapter);
    $pagerfanta->setMaxPerPage(10);
    $pagerfanta->setCurrentPage($request->query->get('page', 1));

    return $app['twig']->render('index.html', array(
        'my_pager' => $pagerfanta
    ));
})

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 52.1% 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 ~371 days

Total

3

Last Release

4053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/571bc5d492f577748449e5624607338f321e59571a60043b65970f4129def671?d=identicon)[sinasalek](/maintainers/sinasalek)

---

Top Contributors

[![franmomu](https://avatars.githubusercontent.com/u/720690?v=4)](https://github.com/franmomu "franmomu (25 commits)")[![jmontoyaa](https://avatars.githubusercontent.com/u/158935?v=4)](https://github.com/jmontoyaa "jmontoyaa (5 commits)")[![sinasalek](https://avatars.githubusercontent.com/u/592240?v=4)](https://github.com/sinasalek "sinasalek (5 commits)")[![jianjye](https://avatars.githubusercontent.com/u/400056?v=4)](https://github.com/jianjye "jianjye (4 commits)")[![glisandro](https://avatars.githubusercontent.com/u/470037?v=4)](https://github.com/glisandro "glisandro (3 commits)")[![mweimerskirch](https://avatars.githubusercontent.com/u/362092?v=4)](https://github.com/mweimerskirch "mweimerskirch (2 commits)")[![pplotka](https://avatars.githubusercontent.com/u/1835375?v=4)](https://github.com/pplotka "pplotka (2 commits)")[![addfs](https://avatars.githubusercontent.com/u/184040?v=4)](https://github.com/addfs "addfs (1 commits)")[![dominikzogg](https://avatars.githubusercontent.com/u/1011217?v=4)](https://github.com/dominikzogg "dominikzogg (1 commits)")

---

Tags

service providerpagerfantasilex

### Embed Badge

![Health badge](/badges/sinasalek-silex-pagerfanta-provider/health.svg)

```
[![Health](https://phpackages.com/badges/sinasalek-silex-pagerfanta-provider/health.svg)](https://phpackages.com/packages/sinasalek-silex-pagerfanta-provider)
```

###  Alternatives

[babdev/pagerfanta-bundle

Bundle integrating Pagerfanta with Symfony

20817.8M65](/packages/babdev-pagerfanta-bundle)[franmomu/silex-pagerfanta-provider

Silex ServiceProvider for Pagerfanta Library

1312.1k](/packages/franmomu-silex-pagerfanta-provider)[igorw/config-service-provider

A config ServiceProvider for Silex with support for php, json and yaml.

215636.5k13](/packages/igorw-config-service-provider)[emanueleminotto/faker-service-provider

Faker Service Provider for Silex

162.9k](/packages/emanueleminotto-faker-service-provider)

PHPackages © 2026

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