PHPackages                             spagination/sprint-framework-pagination-package - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. spagination/sprint-framework-pagination-package

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

spagination/sprint-framework-pagination-package
===============================================

This is a simple and small single class PHP pagination that handles the pagination based on the http request.

1.0.0(4y ago)13MITPHP

Since Jun 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/inaciowassir/spagination)[ Packagist](https://packagist.org/packages/spagination/sprint-framework-pagination-package)[ RSS](/packages/spagination-sprint-framework-pagination-package/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Simple and smart pagination builder
===================================

[](#simple-and-smart-pagination-builder)

### This libary is part of sprint framework packages

[](#this-libary-is-part-of-sprint-framework-packages)

**Version 1.0.0**

Hey! This is a simple and small single class PHP pagination that handles the pagination based on the http request. All properties and methods are statics. The codebase is very small and very easy to understand. So you can use it as a boilerplate for a more complex pagination.

---

Installation including the file
-------------------------------

[](#installation-including-the-file)

```
// Require the class
include 'src\SPagination.php';
```

Installation using Composer
---------------------------

[](#installation-using-composer)

Just run `composer require spagination/sprint-framework-pagination-package`Than add the autoloader to your project like this:

```
// Autoload files using composer
require_once __DIR__ . '/vendor/autoload.php';

// Use this namespace
use sprint\spagination\SPagination;

		// Create an instance of the SPagination class and pass the current page retrieved via http request and the number of results per page as parameters to the constructor
		//First parameter is the page the current page number and second is the limit per page
		$spagination = new SPagination(intval($_GET['page']), 5);

// sql query offset, dynamically generated via the number of results to display per page and the current page number
		//echo $spagination::$offset;

// How to use with the database (This example consider the mysqli, but you can use PDO or any other drivers as well)
// First connect to your database
		$conn   = mysqli_connect("localhost","root","password","database");

//Select the table, use $spagination::$limit to get number of result to return and $spagination::$offset to get the offset dynamically
//To get the total filtered rows use SQL_CALC_FOUND_ROWS command in your query this will ignored the limit and run the query as no limit was informed
		$query  = mysqli_query($conn, "SELECT SQL_CALC_FOUND_ROWS * FROM table ORDER BY id ASC LIMIT ".$spagination::$limit." OFFSET ".$spagination::$offset."");
		$results = array();

// Total filtered results from the sql query
		$total = mysqli_fetch_assoc(mysqli_query($conn, "SELECT FOUND_ROWS() AS totalFiltered"));
		$spagination::$total = $total["totalFiltered"];

//Now fetch the data and store in array
		while($row = mysqli_fetch_assoc($query)){
			$results[] = $row;
		}

// Either show dots in the pagination or not(Accept boolean value)
		$spagination::$dots = true;//false

//debug the database results with the pagination
		echo "";
			var_dump($results);
		echo "";
// Build the pagination
		echo $spagination::page();
```

Custom pagination style
-----------------------

[](#custom-pagination-style)

> The SPagination uses bootstrap as default style, but you can create your own custom style by defining the classes to the elements. *Please refer to the bootstrap documentation for more details, in case you want to use bootstrap for styling your pagination* [](https://getbootstrap.com)

```
//This will add custom class to anchor element
//Add general class to the class key and active class to the active key
$spagination::$classes["a"] = array(
	"class" => [""] //default class: ["page-link"]
	"active" => [""] //default class: ["active", "disabled"]
);

//This will add custom class to list item element
//Add general class to the class key and active class to the active key (this is used in case you use list item to style active behaviour)
$spagination::$classes["li"] = array(
	"class" => [""] //default class: ["page-item"]
	"active" => [""]
);

//This will add custom class to unordered list element
//Add general class to the class key
$spagination::$classes["ul"] = array(
	"class" => [""] //default class: ["pagination"]
);
```

License
-------

[](#license)

This project is licensed under the MIT License. See [License File](https://github.com/inaciowassir/spagination/blob/main/LICENSE) for further information.

Contributors
------------

[](#contributors)

- Inacio Agostinho Uassire

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1473d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5cfa35df1f7c62d2b336a7e59b3910c8b3d2bd37e2f29916c7c8f52994d297b?d=identicon)[inaciowassir](/maintainers/inaciowassir)

---

Top Contributors

[![inaciowassir](https://avatars.githubusercontent.com/u/63661646?v=4)](https://github.com/inaciowassir "inaciowassir (14 commits)")

---

Tags

pagespaginatingpaginator

### Embed Badge

![Health badge](/badges/spagination-sprint-framework-pagination-package/health.svg)

```
[![Health](https://phpackages.com/badges/spagination-sprint-framework-pagination-package/health.svg)](https://phpackages.com/packages/spagination-sprint-framework-pagination-package)
```

###  Alternatives

[alexis-magina/cmb2-field-post-search-ajax

CMB2 field type to attach posts to each others. Search with Ajax.

3913.5k1](/packages/alexis-magina-cmb2-field-post-search-ajax)[affordablemobiles/g-serverless-support-laravel

Google Serverless runtime support for Laravel apps

3313.5k](/packages/affordablemobiles-g-serverless-support-laravel)[tomverran/robots-txt-checker

Given a robots.txt file, user agent and URL path will tell you whether you're allowed to access a page

1264.1k3](/packages/tomverran-robots-txt-checker)[oriceon/laravel-settings

Laravel 5 persistent settings

207.2k1](/packages/oriceon-laravel-settings)

PHPackages © 2026

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