PHPackages                             ssv445/aggregation-builder-pagination-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. ssv445/aggregation-builder-pagination-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

ssv445/aggregation-builder-pagination-bundle
============================================

Paginate Doctrine MongoDB ODM AggregationBuilder with KnpPaginatorBundle

2.0.1(2y ago)117MITPHPPHP ^8.1

Since Apr 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ssv445/aggregationbuilderpaginationbundle)[ Packagist](https://packagist.org/packages/ssv445/aggregation-builder-pagination-bundle)[ RSS](/packages/ssv445-aggregation-builder-pagination-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (5)Versions (5)Used By (0)

LudoAggregationBuilderPaginationBundle
======================================

[](#ludoaggregationbuilderpaginationbundle)

[![pipeline_status](https://camo.githubusercontent.com/a6a89ed0e61811ba7a71a339b9d9e651f8ec6c02907c02b6ddbfe5a77e12dd2c/68747470733a2f2f6769746c61622e636f6d2f7373763434352f6167677265676174696f6e6275696c646572706167696e6174696f6e62756e646c652f6261646765732f6d61737465722f706970656c696e652e737667)](https://camo.githubusercontent.com/a6a89ed0e61811ba7a71a339b9d9e651f8ec6c02907c02b6ddbfe5a77e12dd2c/68747470733a2f2f6769746c61622e636f6d2f7373763434352f6167677265676174696f6e6275696c646572706167696e6174696f6e62756e646c652f6261646765732f6d61737465722f706970656c696e652e737667)

Extension bundle for Symfony's [KnpPaginatorBundle](https://github.com/KnpLabs/KnpPaginatorBundle) that allows to paginate [DoctrineMongoDBBundle](https://github.com/doctrine/DoctrineMongoDBBundle) [`Doctrine\ODM\MongoDB\Aggregation\Builder`](https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.0/reference/aggregation-builder.html).

Requirements
------------

[](#requirements)

Bundle uses MongoDB [`$facet`](https://docs.mongodb.com/manual/reference/operator/aggregation/facet/) operator which is available since MongoDB 3.4.

Installation with Symfony Flex
------------------------------

[](#installation-with-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require ssv445/aggregation-builder-pagination-bundle
```

Installation without Symfony Flex
---------------------------------

[](#installation-without-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require ssv445/aggregation-builder-pagination-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Ludo\Bundle\AggregationBuilderPaginationBundle\LudoAggregationBuilderPaginationBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

[`Doctrine\ODM\MongoDB\Aggregation\Builder`](https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.0/reference/aggregation-builder.html) needs to be passed into `paginate()` method. Be aware that most of the `Builder` methods are returning `Doctrine\ODM\MongoDB\Aggregation\Stage`. So you need to do eg.:

```
// src/Repository/ExampleRepository.php
use Doctrine\ODM\MongoDB\Aggregation\Builder as AggregationBuilder;
// ...

class ExampleRepository extends Repository
{
    public function getExamples(): AggregationBuilder
    {
        $ab = $this->createAggregationBuilder();

        $ab->hydrate(Example::class)
            ->match()
                ->field('field')
                ->equals('value');

        return $ab;
    }
}
```

As `->equals('value')` would not return `AggregationBuilder`, the code would throw an `Exception` if you return the result of that method directly. Now to paginate the example repository method, you can just do:

```
// src/Subfolder/ExamplePagination.php
// ...

class ExamplePagination
{
    // ...

    public function __construct(DocumentManager $manager, PaginatorInterface $paginator)
    {
        $this->manager = $manager;
        $this->paginator = $paginator;
    }

    public function getPaginatedExamples(): PaginationInterface
    {
        return $this->paginator->paginate(
            $this->manager->getRepository(ExampleRepository::class)->getExamples()
        );
    }
}
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% 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 ~462 days

Total

4

Last Release

896d ago

Major Versions

1.0.1 → 2.0.02024-01-18

PHP version history (2 changes)1.0.0PHP ^7.3

2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54636991?v=4)[SafiMoney](/maintainers/safimoney)[@safimoney](https://github.com/safimoney)

---

Top Contributors

[![ssv445](https://avatars.githubusercontent.com/u/229291?v=4)](https://github.com/ssv445 "ssv445 (5 commits)")[![Ludo444](https://avatars.githubusercontent.com/u/7080959?v=4)](https://github.com/Ludo444 "Ludo444 (3 commits)")

---

Tags

symfonybundlepagerpaginatorpaginationmongodbaggregation

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ssv445-aggregation-builder-pagination-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ssv445-aggregation-builder-pagination-bundle/health.svg)](https://phpackages.com/packages/ssv445-aggregation-builder-pagination-bundle)
```

###  Alternatives

[knplabs/knp-paginator-bundle

Paginator bundle for Symfony to automate pagination and simplify sorting and other features

1.8k44.9M357](/packages/knplabs-knp-paginator-bundle)[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2841.5M6](/packages/omines-datatables-bundle)[data-dog/pager-bundle

Paginator bundle for symfony2 and doctrine orm, allows customization with filters and sorters

11105.5k7](/packages/data-dog-pager-bundle)

PHPackages © 2026

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