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

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

bojaghi/pagination
==================

Simple pagination range generation helper

1.0.1(1y ago)05GPL-2.0-or-laterPHPPHP &gt;=8.0

Since Oct 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bojaghi/pagination)[ Packagist](https://packagist.org/packages/bojaghi/pagination)[ Docs](https://github.com/bojaghi/pagination)[ RSS](/packages/bojaghi-pagination/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Pagination
==========

[](#pagination)

게시판과 유사한 목록 페이지를 만들면, 항상 페이지네이션을 생각해야 합니다. 이 패키지는 워드프레스의 WP\_Query 객체로부터 쉽게 페이지네이션의 시작과 끝을 구할 수 있게 도와줍니다.

사용방법
----

[](#사용방법)

### 방법 1: 생성자에 WP\_Query 넣기

[](#방법-1-생성자에-wp_query-넣기)

WP\_Query 사용시, 객체를 생성자로 넣어주면 됩니다.

```
$p = new Pagination($wp_query);
// create() 를 호출할 필요가 없습니다.

$begin = $p->getBegin();
$end   = $p->getEnd();
```

### 방법 2: 메서드 사용

[](#방법-2-메서드-사용)

메서드를 사용해 WP\_Query를 지정합니다.

```
$p = new Pagination();
$p->setQuery($wp_query);
// create() 를 호출할 필요가 없습니다.

$begin = $p->getBegin();
$end   = $p->getEnd();
```

### 방법 3: 파리미터를 직접 입력

[](#방법-3-파리미터를-직접-입력)

WP\_Query를 사용하지 않는 경우, 직접 파라미터를 입력하여 계산할 수 있습니다.

```
$p = new Pagination();
$p
 ->setSize(5)      // 페이지네이션 길이. 기본 5.
 ->setNumItems(10) // 한 페이징당 표시할 아이템 수.
 ->setTotal(130)   // 모든 게시물의 수.
 ->setCurrent(2)   // 현재 페이지.
 ->create()        // 반드시 create() 함수를 호출해야 합니다.
;

$begin = $p->getBegin();
$end   = $p->getEnd();
```

페이지네이션 계산 방식
------------

[](#페이지네이션-계산-방식)

### 섹션

[](#섹션)

setType() 메서드에 `Pagination::TYPE_SECTION`을 입력하여 설정할 수 있습니다. 기본값입니다. 페이지네이션 사이즈만큼 표시하는데, 분할된 섹션 안에서 현재 페이지는 적당히 배치시키는 방식입니다. 아래 예시를 참고하세요. \[ \] 안의 숫자는 현재 페이지입니다.

```
e.g. size=5

[1] 2 3 4 5  // 1-5 가 한 색션.
1 [2] 3 4 5  // 섹션 내 숫자를 항상 배치. 현재 페이지는 이 중 적당히 위치함.
1 2 [3] 4 5
1 2 3 [4] 5
1 2 3 4 [5]
[6] 7 8 9 10 // 6-10 은 다른 한 섹션.
6 [7] 8 9 10
6 7 [8] 9 10
6 7 8 [9] 10
6 7 8 9 [10]

```

### 센터

[](#센터)

setType() 메서드에 `Pagination::TYPE_CENTER`를 입력하여 설정할 수 있습니다. 페이지네이션 사이즈만큼 표시되며, 현재 페이지가 항상 가운데 위치하게끔 최선을 다합니다. 아래 예시를 참고하세요.

```
e.g. size=5
[1] 2 3 4 5  // 항상 가운데 위치할 수는 없음!
1 [2] 3 4 5  //
1 2 [3] 5 5  // 이제부터 현재 페이지는 가운데 고정.
2 3 [4] 5 6
3 4 [5] 6 7
4 5 [6] 7 8
5 6 [7] 8 9
6 7 [8] 9 10

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Every ~1 days

Total

2

Last Release

560d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.2

1.0.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bbfd1d4316ffdccc98504cdbdd210c69a6add7dca21678ad402ccedb3ff4764?d=identicon)[ep6tri](/maintainers/ep6tri)

---

Top Contributors

[![chwnam](https://avatars.githubusercontent.com/u/6630320?v=4)](https://github.com/chwnam "chwnam (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[naffiq/telegram-channel-php

Post to your telegram channel with ease!

124.2k](/packages/naffiq-telegram-channel-php)

PHPackages © 2026

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