{"id":26698732,"url":"https://github.com/benhall14/php-pagination","last_synced_at":"2025-04-13T05:39:41.288Z","repository":{"id":62493064,"uuid":"173610278","full_name":"benhall14/php-pagination","owner":"benhall14","description":"A lightweight PHP pagination class to output pagination links.","archived":false,"fork":false,"pushed_at":"2019-08-07T21:16:38.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T16:38:18.308Z","etag":null,"topics":["bootstrap-pagination","pagination","pagination-links","php","php-pagination"],"latest_commit_sha":null,"homepage":"https://conobe.co.uk/projects/php-pagination","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benhall14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-03T17:59:03.000Z","updated_at":"2023-03-06T03:50:29.000Z","dependencies_parsed_at":"2022-11-02T09:30:55.586Z","dependency_job_id":null,"html_url":"https://github.com/benhall14/php-pagination","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhall14%2Fphp-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhall14%2Fphp-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhall14%2Fphp-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhall14%2Fphp-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benhall14","download_url":"https://codeload.github.com/benhall14/php-pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670506,"owners_count":21142897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap-pagination","pagination","pagination-links","php","php-pagination"],"created_at":"2025-03-26T22:19:05.309Z","updated_at":"2025-04-13T05:39:41.140Z","avatar_url":"https://github.com/benhall14.png","language":"PHP","funding_links":["https://paypal.me/benhall14"],"categories":[],"sub_categories":[],"readme":"# PHP Pagination\n A lightweight PHP pagination class to output pagination links.\n\nThis class is written to be chain-able so to create a logically fluent and easily readable way to create a set of pagination links.\n\nIt simplifies the paging of results and outputs Bootstrap 4 compatible navigation HTML.\n\nIt has been fully tested to work with PHP 5.5+, including **PHP 7+**\n\n# Installation via Composer\nYou can now install this class via composer.\n\n\t$ composer require benhall14/php-pagination\n\t\n**Remember** to add the composer autoloader before using the class and use the correct namespace.\n\n\trequire 'vendor/autoload.php';\n\n\tuse benhall14\\PHPPagination\\Pagination as Pagination;\n\n# Usage\nPlease make sure you have added the required classes.\n\nIn its simplest form, you can use the following to set up the paginator.\n\n```php\n$pagination = new Pagination();\n$pagination-\u003etotal(100)-\u003eoutput();\n```\n\nYou can use the following chainable methods to customise the final pagination links.\n```php\n# sets the total number of items in the collection - e.g. 100\n$pagination-\u003etotal(number);\n\n# sets the current page. By default, the class looks for the page value in the GET query string.\n$pagination-\u003epage(number);\n\n# sets the number of items to show per page. Default = 20\n$pagination-\u003eperPage(number);\n\n# sets the separator (if using). Default '...'\n$pagination-\u003eseparator(text);\n\n# sets the screen reader class. Default 'true', but you may need to set it to false if you are using your own custom css.\n$pagination-\u003escreenReader(bool);\n\n# sets the Bootstrap 4 pagination link class to small\n$pagination-\u003esmall();\n\n# sets the Bootstrap 4 pagination link class to medium\n$pagination-\u003emedium();\n\n# sets the Bootstrap 4 pagination link class to large\n$pagination-\u003elarge();\n\n# sets the Bootstrap 4 alignment class to left\n$pagination-\u003ealignLeft();\n\n# sets the Bootstrap 4 alignment class to center\n$pagination-\u003ealignCenter();\n\n# sets the Bootstrap 4 alignment class to right\n$pagination-\u003ealignRight();\n\n# sets the flag to show the separator\n$pagination-\u003eshowSeparator();\n\n# sets the flag to hide the separator\n$pagination-\u003ehideSeparator();\n\n# sets the next text string - Default: 'Next'\n$pagination-\u003enextText(text);\n\n# sets the previous text string - Default: 'Previous'\n$pagination-\u003epreviousText(text);\n\n# hides the 'Next' link\n$pagination-\u003ehideNext();\n\n# shows the 'Next' link\n$pagination-\u003eshowNext();\n\n# hides the 'Previous' link\n$pagination-\u003ehidePrevious();\n\n# shows the 'Previous' link\n$pagination-\u003eshowPrevious();\n\n# sets a prefix text for each page link: {prefix} {page number} {suffix}\n$pagination-\u003epagePrefix(text);\n\n# sets a suffix text for each page link: {prefix} {page number} {suffix}\n$pagination-\u003epageSuffix(text);\n\n# sets the flag to retain the query string for each page link.\n$pagination-\u003eretainQueryString();\n\n# sets the flag to ignore the query string when building the links\n$pagination-\u003edismissQueryString();\n\n# sets the number of pages BEFORE the separator\n$pagination-\u003epagesBeforeSeparator(number);\n\n# sets the number of pages AROUND the active page\n$pagination-\u003epagesAroundActive(number);\n\n# sets the URL pattern - Default $pattern: ?page=(:num)- $replacement: (:num)\n$pagination-\u003epattern($pattern, $replacement);\n# The class will replace the $replacement token in the $pattern with the actual page number\n```\n\n# Requirements\n\n**Works with PHP 5.5, PHP 5.6, and PHP 7+**\n\n# License\nCopyright (c) 2016-2019 Benjamin Hall, ben@conobe.co.uk\nhttps://conobe.co.uk\n\nLicensed under the MIT license\n\n# Donate?\n\nIf you find this project helpful or useful in any way, please consider getting me a cup of coffee - It's really appreciated :)\n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/benhall14)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhall14%2Fphp-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenhall14%2Fphp-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhall14%2Fphp-pagination/lists"}