PHPackages                             duykpro/simple-pagination - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. duykpro/simple-pagination

ActiveLibrary

duykpro/simple-pagination
=========================

A simple PHP pagination class working perfectly with all PHP projects

1.2(7y ago)038PHP

Since Aug 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/duykpro/simple-pagination)[ Packagist](https://packagist.org/packages/duykpro/simple-pagination)[ Docs](http://duyk.info)[ RSS](/packages/duykpro-simple-pagination/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Description
-----------

[](#description)

This is a Simple PHP pagination class working perfectly with all PHP projects

Example of usage:
-----------------

[](#example-of-usage)

```

$config = array(
	'base_url' => 'http://example.com/',
	'uri_path' => '', // URI path (IE: controller/action/id), leave none for auto detection
    'num_links' => 3, // Number of page links to show

    'total_items' => 0, // Total items (ie: count($allRowsFromDatabase))
    'items_per_page' => 20, // Number of items per page

    'get_query' => false, // (Default is false). Using query string or uri segment? See example below
    'uri_segment_position' => 0, // (if "get_query" is "false") Count from 0, Exp: controller/action/id/{page} => 3

    // (Optional) Page prefix and suffix (Exp: ?page=prefix{page}suffix)
    'prefix' => '',
    'suffix' => '',

    // (Optional) Link text
    'first_link_text' => 'First',
    'last_link_text' => 'Last',

    'previous_link_text' => 'Previous',
    'next_link_text' => 'Next'
);
$pagination = new DuyK\Pagination($config);

// Pagination data
$paginationData = $pagination->generate(); // You can use var_dump($paginationData) to see the structure

```

HTML:

```

```

Example of using "get\_query" =&gt; true
----------------------------------------

[](#example-of-using-get_query--true)

If "get\_query" is "true", meaning that we'll use a HTTP GET param as your current page

```
// If setting "get_query" => true
$config = array(
	...YOUR OTHER CONFIG...
	'uri_path' => 'blog/something',
	'get_query' => 'page',
);

```

Result will be like this:

```
If URL is: http://example.com/blog
Then pagination links will be:
http://example.com/blog?page=1
http://example.com/blog?page=2
http://example.com/blog?page=3
http://example.com/blog?page=4
...

Don't worry if your URL contains other GET param. For example if your URL is: http://example.com/blog?param1=test&param2=something
Then pagination links will be:
http://example.com/blog?param1=test&param2=something&page=1
http://example.com/blog?param1=test&param2=something&page=2
http://example.com/blog?param1=test&param2=something&page=3
http://example.com/blog?param1=test&param2=something&page=4
...

```

Example of using "get\_query" =&gt; false
-----------------------------------------

[](#example-of-using-get_query--false)

If "get\_query" is false, meaning that we'll use a segment in your URI path to detect your current page

```

// If setting "get_query" => false
// Full URL in this example: http://example.com/blog/category-name/1/something/else (1 is the current page)
// Also available if the "page" is the last segment like: http://example.com/blog/category-name/{page}
// If {page} is null, then its value will be treated as "1"
$config = array(
	...YOUR OTHER CONFIG...
	'get_query' => false,
	'uri_segment_position' => 2, // Will be 2 in this case because [0 => 'blog', 1 => 'category-name', 2 => {page-number-here}...]
);

```

Result will be like this

```
http://example.com/blog/category-name/1/something/else
http://example.com/blog/category-name/2/something/else
http://example.com/blog/category-name/3/something/else
http://example.com/blog/category-name/4/something/else
...

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~395 days

Total

3

Last Release

2755d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07a97594da1c75bbb7b771f55f6feff071b7f866d771b25f20622fcda860188f?d=identicon)[duykpro](/maintainers/duykpro)

---

Top Contributors

[![duykpro](https://avatars.githubusercontent.com/u/7447265?v=4)](https://github.com/duykpro "duykpro (2 commits)")

### Embed Badge

![Health badge](/badges/duykpro-simple-pagination/health.svg)

```
[![Health](https://phpackages.com/badges/duykpro-simple-pagination/health.svg)](https://phpackages.com/packages/duykpro-simple-pagination)
```

###  Alternatives

[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[api-platform/validator

API Platform validator component

223.2M10](/packages/api-platform-validator)[symfony/ux-notify

Native notification integration for Symfony

1274.7k](/packages/symfony-ux-notify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
