nitra/pagerfanta
Laravel integration for the Pagerfanta pagination library. It bridges Eloquent and query builder results with Pagerfanta paginators, provides Blade-friendly rendering and configurable templates, and makes it easy to add consistent pagination to Laravel applications.
What the package is. nitra/pagerfanta is a fork of Pagerfanta — a framework-agnostic PHP pagination library built around two abstractions: an Adapter (wraps a data source such as a Doctrine query, an array, or a raw callable and answers getNbResults() / getSlice()) and a View (renders page links). The nitra fork is explicitly targeted at PHP 5.3, which reached end of life in August 2014. It is not a Laravel package in any meaningful sense: no service provider with auto-discovery, no facade, no Blade integration, no illuminate/support constraint, and no compatibility statement against any Laravel version.
Architecture fit — poor. Laravel ships Illuminate\Pagination in the core framework. It provides LengthAwarePaginator, Paginator, CursorPaginator, Blade rendering ($paginator->links()), JSON serialization for API resources, and query-string preservation — all first-party, all versioned in lockstep with the framework. Adopting Pagerfanta means introducing a parallel pagination abstraction alongside the native one, which is a net-negative for consistency and for any developer joining the team. The only defensible fit is a legacy application whose domain layer already speaks Pagerfanta\PagerfantaInterface and where a rewrite is out of scope.
Integration feasibility — low, and declining. Realistically workable only on the Laravel 4.x–5.1 era, PHP 5.3–5.6. On any modern stack the package will fail Composer resolution against current illuminate/* constraints, has no extra.laravel block for package discovery (Laravel 5.5+), and predates PSR-4/PSR-11 conventions that modern Laravel container wiring assumes. Any integration would require a hand-written service provider, manual binding of adapters, and a custom view layer — i.e. we would be writing the integration ourselves and owning it forever.
Package health signals — effectively zero. The scorecard reads: 0 stars, 0 dependents, a Bitbucket origin rather than Packagist/GitHub, and no visible release cadence. Zero dependents is the decisive datapoint: no other package in the ecosystem pulls this in, meaning there is no downstream testing, no bug reports, no incidental maintenance. A Bitbucket-hosted personal fork is also a single point of disappearance — no mirror, no guarantee the repository survives a hosting or account change. Treat availability as a risk to be mitigated, not assumed.
Technical risk.
SELECT COUNT(*) across large tables are a classic performance trap; the fork inherits whatever the upstream did at that snapshot with no fixes since.Key questions to resolve before any decision.
Illuminate\Pagination, or is it a rendering/aesthetics need that a custom Blade view would satisfy?Recommendation: do not adopt. Approve only as a time-boxed containment measure inside a legacy application already using it, paired with an explicit decommission ticket.
Stack fit. Greenfield or actively-maintained Laravel: no fit. Use Illuminate\Pagination — paginate() on the query builder or Eloquent, simplePaginate() where a total count is unnecessary, and cursorPaginate() where the dataset is large or the sort key is stable. This requires zero new dependencies, gets security patches with the framework, and is documented in the framework's own docs. The migration cost is measured in hours, not weeks, for typical controller/Blade usage.
Legacy-containment path (if the dependency already exists). Sequence it as a strangler, not a big-bang:
Pagerfanta, PagerfantaInterface, and the view helper names; produce a call-site list with owning teams. Output: a count and a blast radius.App\Contracts\Paginator) at controller/Blade boundaries so call sites stop naming Pagerfanta types directly.LengthAwarePaginator, migrate one surface at a time, and delete each Pagerfanta adapter as its last caller moves.Compatibility work required if adopted as-is. A hand-rolled service provider registered in config/app.php (no auto-discovery); explicit require pins to prevent Composer from resolving a transitive illuminate/support that conflicts; a compatibility shim for any namespace or API drift between the fork and whatever Pagerfanta version the existing code expects; and a CI job that builds against the actual pinned PHP version so drift is caught at PR time rather than at deploy.
Sequencing against business commitments. Do not couple the replacement to a feature release. Ship the internal interface first (invisible to users), then migrate call sites behind it, then cut over. This keeps pagination behaviour stable across the transition and makes each step independently revertible.
Maintenance. The package has no maintainer we can influence and no upstream we can file against. Every bug becomes an internal bug; every fix becomes an internal fork. Budget it as self-maintained code with no community, not as a dependency. Concretely: assume a fork-and-own cost, assign a named owner, and record it in the dependency register with a review date.
Support and knowledge. Zero dependents and zero stars means zero Stack Overflow corpus, zero blog posts, and no one to ask. Onboarding a new engineer to this code is entirely internal documentation — and that documentation only exists if we write it. Contrast with Illuminate\Pagination, where the answer to almost any question is one search away.
Scaling. Pagination logic itself is not the bottleneck; the query pattern is. Offset pagination implies a COUNT(*) and a deep OFFSET scan, both of which degrade non-linearly on large tables and are the most likely production symptom to surface as the product grows. Where pagination touches the largest tables, the correct answer is keyset/cursor pagination — available natively — rather than optimising around a 2012-era adapter.
Failure modes to plan for.
composer update and hits a wall. Mitigation: explicit upgrade-blocker ticket with a target date.Ramp-up. For a developer already fluent in Pagerfanta, the API is small and learnable in under a day. The real ramp-up cost is not the library — it is reconstructing why the fork exists, which fixes it carries, and what the original author intended. That context is almost certainly not written down. For Illuminate\Pagination, ramp-up is near-zero for anyone with Laravel experience, which is the dominant practical argument in its favour.
Bottom line for the roadmap. This package should appear on the technical-debt register, not the platform roadmap. The decision to make is not "how do we integrate it" but "what is the date by which it is removed," and the answer should be driven by the PHP runtime upgrade timeline rather than by pagination requirements.
How can I help you explore Laravel packages today?