Download the PHP package tiloweb/pagination-bundle without Composer
On this page you can find all versions of the php package tiloweb/pagination-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tiloweb/pagination-bundle
More information about tiloweb/pagination-bundle
Files in tiloweb/pagination-bundle
Package pagination-bundle
Short Description A simple and elegant pagination bundle for Symfony using Doctrine ORM Paginator
License MIT
Homepage https://github.com/Tiloweb/SymfonyPaginationBundle
Informations about the package pagination-bundle
TilowebPaginationBundle
A simple and elegant pagination bundle for Symfony using Doctrine ORM Paginator. This bundle provides an easy-to-use service for paginating database queries and a Twig function for rendering pagination controls.
✨ Features
- 🚀 Simple API - Paginate any Doctrine QueryBuilder with a single method call
- 🎨 Customizable templates - Use the default Bootstrap-compatible template or create your own
- ♿ Accessible - Default template includes ARIA attributes for screen readers
- 🔧 Configurable - Adjust page range, items per page, and template path
- 📦 Lightweight - Minimal dependencies, leverages Doctrine's built-in Paginator
- ✅ Modern PHP - Strict types, readonly classes, PHP 8.2+ features
📋 Requirements
- PHP 8.2 or higher
- Symfony 6.4, 7.x, or 8.x
- Doctrine ORM 2.14+ or 3.x
- Twig 3.x
📥 Installation
Install the bundle using Composer:
If you're using Symfony Flex, the bundle will be automatically enabled. Otherwise, add it to your config/bundles.php:
⚙️ Configuration
The bundle works out of the box with sensible defaults. You can customize it by creating a configuration file:
🚀 Usage
Basic Usage with the Paginator Service
In Your Twig Template
Advanced Repository Pattern
Create a reusable pagination method in your repository:
Custom Pagination Template
Create your own template for complete control over the pagination markup:
Use it in your template:
Or set it globally in your configuration:
📖 PaginationResult API
The PaginationResult object provides useful methods for pagination:
| Method | Description |
|---|---|
getCurrentPage() |
Returns the current page number |
getTotalPages() |
Returns the total number of pages |
getTotalItems() |
Returns the total count of items |
getItemsPerPage() |
Returns items per page |
hasPreviousPage() |
Returns true if there's a previous page |
hasNextPage() |
Returns true if there's a next page |
getPreviousPage() |
Returns previous page number or null |
getNextPage() |
Returns next page number or null |
getFirstItemOnPage() |
Returns first item index on current page |
getLastItemOnPage() |
Returns last item index on current page |
isFirstPage() |
Returns true if on first page |
isLastPage() |
Returns true if on last page |
getPageRange(int $range) |
Returns array of page numbers for display |
🔄 Migration from v2.x
If you're upgrading from version 2.x, please note the following changes:
- Namespace change: Classes moved from root to
src/directory - PHP requirement: Minimum PHP version is now 8.2
- Symfony requirement: Minimum Symfony version is now 6.4
- New service: Use the
Paginatorservice instead of static methods - Return type:
paginate()now returnsPaginationResultinstead of Doctrine'sPaginator
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
📄 License
This bundle is released under the MIT License.
👤 Author
Thibault HENRY
- Website: tiloweb.com
- Email: [email protected]
- GitHub: @Tiloweb
All versions of pagination-bundle with dependencies
doctrine/orm Version ^2.14|^3.0
symfony/framework-bundle Version ^6.4|^7.0|^8.0
symfony/http-foundation Version ^6.4|^7.0|^8.0
symfony/http-kernel Version ^6.4|^7.0|^8.0
symfony/dependency-injection Version ^6.4|^7.0|^8.0
symfony/config Version ^6.4|^7.0|^8.0
twig/twig Version ^3.0