Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laminas Paginator Laravel Package

laminas/laminas-paginator

Laminas Paginator provides flexible pagination for PHP apps, with adapters for arrays, iterators, and database results. Generate page ranges and navigation data, and integrate with Laminas MVC or use standalone for paged listings.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing via Composer: composer require laminas/laminas-paginator. Then, create a paginator by wrapping any traversable data source (array, Doctrine Query, custom iterator) in a Laminas\Paginator\Paginator instance and specifying an adapter (e.g., Laminas\Paginator\Adapter\ArrayAdapter, Laminas\Paginator\Adapter\DbSelect). Configure the adapter with your data source and call $paginator->setCurrentPageNumber($page) and $paginator->setItemCountPerPage($count). For immediate output, render using a view helper like $this->paginator($paginator, 'scrolling_style') in a Blade or Twig view (via integration with Laravel's view layer), or iterate over $paginator directly in Blade.

Implementation Patterns

Use adapters to abstract pagination logic: for Eloquent, wrap Model::where(...)->cursor() in Laminas\Paginator\Adapter\Callback or use the Laminas\Paginator\Adapter\LaravelEloquent community adapter (or build a simple custom one using count() and skip()->take()). Integrate with Laravel’s Request by injecting request()->get('page', 1) into setCurrentPageNumber(). Combine with Laravel’s pagination links via render() returning HTML compatible with Bootstrap/Tailwind if adapted correctly. Use caching adapters (e.g., Laminas\Paginator\Adapter\NullAdapter for mocks or custom caching wrappers) for expensive queries—cache the total count and slices. For APIs, return JSON with toArray() and embed metadata (total, current, per_page) manually or via a transformer.

Gotchas and Tips

Adapter choice is critical: DbSelect requires explicit adapter setup (not auto-inferred), and ArrayAdapter loads all items into memory—avoid for large datasets. The pageRange setting in view helpers affects link rendering (e.g., number of page links shown); configure it in config or helper options. Pagination state is not persisted across requests unless you manually store it (e.g., in session or query params); always initialize with request context. Debug with $paginator->getPages() to inspect metadata (current, total, next/prev pages). If using with Eloquent, prefer simplePaginate() or custom adapters that use skip()->take() instead of count()-heavy methods for performance. Custom adapters must implement getItems($offset, $itemCountPerPage) returning an array and count() returning an int. Note: As of 2025, laminas-paginator has minimal Laravel-specific integration—patch view helpers or create a service provider to bind adapters cleanly to Laravel’s container.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport