Download the PHP package s-damian/damian-pagination-php without Composer
On this page you can find all versions of the php package s-damian/damian-pagination-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download s-damian/damian-pagination-php
More information about s-damian/damian-pagination-php
Files in s-damian/damian-pagination-php
Package damian-pagination-php
Short Description PHP library of simple Pagination
License MIT
Informations about the package damian-pagination-php
PHP Pagination Library - Open Source
Damian Pagination PHP - Open Source Pagination
Introduction - Damian Pagination PHP
Damian Pagination PHP is an open-source PHP library designed to provide simple yet comprehensive pagination functionality.
This pagination library is compatible with all PHP projects (with or without MVC frameworks) and is also compatible with Bootstrap 5 CSS.
Key Features
- Simple library for pagination.
- Customizable per page options.
- Support for multiple languages.
- Compatible with Bootstrap 5.
Paginate easily without limits 🚀
Basic Example
Author
This package is developed by Stephen Damian.
✨ If you find this package useful, please star it on the GitHub repository.
Requirements
- PHP 8.0 || 8.1 || 8.2 || 8.3
Summary
- Introduction
- Installation
- Pagination Instance Methods
- Examples
- Simple Example
- Example With SQL Queries
- Example With a List of Files of a Directory
- Instance Options
- Language Configuration
- Support
- License
Introduction
This Open Source pagination contains PHP files, and one CSS style sheet.
An example of a CSS style sheet is in vendor/s-damian/damian-pagination-php/src/css
directory. You can edit them according to your needs.
This pagination library also allows you to generate a per page form. This will generate an HTML <form>
tag with a <select>
element and clickable options.
Installation
With Composer
Without Composer
If you do not use Composer, you must manually require the necessary files before using this package. Example:
Pagination Instance Methods
Return type | Method | Description |
---|---|---|
void | __construct(array $options = []) | Constructor. |
void | paginate(int $count) | Activate the pagination. |
null or int | getLimit() | LIMIT: Number of items to retrieve. |
null or int | getOffset() | OFFSET: Starting point for the LIMIT. |
int | getCount() | Determine the total number of matching items in the data store. |
int | getCountOnCurrentPage() | Get the number of items for the current page. |
int | getFrom() | Get the result number of the first item in the results. |
int | getTo() | Get the result number of the last item in the results. |
int | getCurrentPage() | Get the current page number. |
int | getNbPages() | Get the page number of the last available page (number of pages). |
int | getPerPage() | The number of items to be shown per page. |
bool | hasPages() | Determine if there are enough items to split into multiple pages. |
bool | hasMorePages() | Determine if there are more items in the data store. |
bool | isFirstPage() | Determine if the paginator is on the first page. |
bool | isLastPage() | Determine if the paginator is on the last page. |
bool | isPage(int $pageNb) | Determine if the paginator is on a given page number. |
null or string | getPreviousPageUrl() | Get the URL for the previous page. |
null or string | getNextPageUrl() | Get the URL for the next page. |
string | getFirstPageUrl() | Get the URL for the first page. |
string | getLastPageUrl() | Get the URL for the last page. |
string | getUrl(int $pageNb) | Get the URL for a given page number. |
string | render() | Make the rendering of the pagination in HTML format. |
string | perPageForm(array $options = []) | Make the rendering of the per page in HTML format. |
Examples
Simple Example
Example rendering of pagination with Bootstrap 5:
Example With SQL Queries
The db()
function must be defined to return a database connection instance, such as PDO.
Depending on your needs, you can also use this library with your favorite ORM.
Example With a List of Files of a Directory
Instance Options
Language Configuration
You can change the default language, which is English ('en') by default.
Supported languages: cn
, de
, ee
, en
, es
, fr
, it
, jp
, pt
, ru
.
Set default language:
Support
If you discover a bug or a security vulnerability, please send a message to Stephen. Thank you.
All bugs and all security vulnerabilities will be promptly addressed.
License
This project is licensed under the MIT License. See the LICENSE file for more details.