Download the PHP package tobento/service-pagination without Composer
On this page you can find all versions of the php package tobento/service-pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tobento/service-pagination
More information about tobento/service-pagination
Files in tobento/service-pagination
Package service-pagination
Short Description Building pagination controls easily.
License MIT
Homepage https://www.tobento.ch
Informations about the package service-pagination
Pagination Service
The Pagination Service provides a way for building pagination controls easily.
Table of Contents
- Getting started
- Requirements
- Highlights
- Screenshots
- Simple Example
- Documentation
- Create Pagination
- Pagination Data
- Current Page Verification
- Render Pagination
- Menu Renderer
- Custom Renderer
- Url Generation
- Default Url Generator
- Custom Url Generator
- Credits
Getting started
Add the latest version of the Pagination service project running this command.
Requirements
- PHP 8.0 or greater
Highlights
- Framework-agnostic, will work with any project
- Decoupled design
- Customize rendering
- Customize url generation
Screenshots
Simple Example
Render the pagination
Documentation
Pagination
Create Pagination
With Methods
You might change some data or implentation by the following "with methods" returning a new instance.
withCurrentPage
withItemsPerPage
withMaxPagesToShow
withUrlGenerator
withRenderer
Pagination Data
You might need the following data for a custom renderer, verifying page number or limiting queries.
Current Page Verification
It is advised to check if the current page exists, especially if you set the current page from user input or based on a url parameter.
Render Pagination
There are different ways of rendering the pagination depending on your needs.
Menu Renderer
The menu renderer is the default pagination renderer. It uses the Menu Service to generate the pagination HTML.
Outputs:
Custom Renderer
You might write your own renderer fitting your application. The following example uses the View Service to generate the pagination HTML.
The view template
Url Generation
Default Url Generator
Custom Url Generator
You might write a custom url generator fitting your application design.
Credits
- Tobias Strub
- All Contributors
Some idea and code snippets is taken from Jasongrimes php-paginator.