Skip to content

xentixar/easy_pagination_in_php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy PHP Pagination

This is a simple PHP library for easy pagination in PHP.

Table of Contents

Installation

  1. Clone the repository or download the ZIP file.
git clone https://github.com/xentixar/easy_pagination_in_php.git
  1. Configure database in database.php inside config directory.
private $database_name = 'your_database_name';
  1. Include autoload.php file in your file
require_once __DIR__ . '/autoload.php';

Usage

  1. Fetch data from table or from any other source as array.

For example:

$data = [
    'data_1','data_2','data_3'
];
  1. Adjust the $limit variable in the PHP script to control the number of records displayed per page.
$limit = 10;
  1. Create an instance of the Pagination class and pass data and limit to it.
$paginator = new Pagination($data, $limit);
  1. Get the paginated data using the paginate method.
$paginated_data = $paginator->paginate();
  1. View the pagination links using the links method.
$paginator->links();

Examples

Check the example directory for sample usage of the pagination library.

Contributing

  • Fork the repository.
  • Create a new branch: git checkout -b feature-name.
  • Commit your changes: git commit -m 'Add new feature'.
  • Push to the branch: git push origin feature-name.
  • Submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Easy pagination in PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages