mrshanebarron/pagination
A Laravel pagination package that provides helpers for creating, rendering, and customizing paginated result sets and navigation links, simplifying multi-page data display in Blade templates and API responses.
Architecture fit. The package follows the conventional Laravel package shape: a service provider with package discovery, a publishable config file, Blade views, and a JSON metadata path for API responses. That is architecturally idiomatic and would slot into a standard Laravel application without structural friction. The concern is value differentiation: the described capability set — Eloquent/query-builder pagination, Blade links, JSON metadata — is functionally co-extensive with first-party LengthAwarePaginator, ->links(), and ->toArray()/API resources. The package's defensible surface is therefore narrow: opinionated Blade markup, a standardized JSON envelope, and centralized page-size configuration. Everything else is framework-provided behavior re-wrapped behind a third-party dependency.
Integration feasibility. Mechanically low effort — Composer install, discovery, vendor:publish, config:clear, one smoke call. The published config is the primary contract (config('sb-*.…')), and the guidance to resolve the service from the container rather than reaching into internals is sound. Real feasibility risk sits in the undocumented: the JSON metadata schema is asserted in the description but not specified, so any consumer (mobile client, partner integration) would be contracting against an unversioned payload shape.
Technical risk. Elevated for the maturity signals in evidence:
Key questions to put to the maintainer (or resolve by reading composer.json and source):
paginate() + API resources does not? Is there a documented JSON contract with a stability guarantee?sb- config prefix — is a bare sb- namespace a collision risk with other Shanebarron packages in the same app?Recommendation: do not adopt as a platform dependency for core pagination. Evaluate as a copy-in reference for Blade templates or as a throwaway spike. Revisit only if the JSON contract is documented and versioned and the maintainer publishes a support matrix.
Stack fit. The package is a plausible fit only where the organization has a genuine cross-service requirement for a uniform pagination envelope and pagination Blade markup — for example, a monorepo of Laravel services whose APIs must all return identically shaped pagination metadata, or a design-system-driven admin surface. In a single application, first-party pagination plus a shared Blade component and a shared API resource class delivers the same standardization with zero external dependency and full ownership of the contract. Absent that multi-service driver, the fit is poor.
Migration path. Do not treat this as a migration. If the estate already uses native pagination, adoption means touching every controller, view, and API serializer — high churn for a capability already present. If adoption is pursued:
composer require mrshanebarron/pagination:1.0.1), not a caret range, until release discipline is demonstrated.PaginationPresenter interface (or a PaginatedResponse API resource) in application code. Implement it with native pagination; add a second implementation backed by the package. This makes adoption reversible and keeps the escape hatch cheap.Compatibility. The v1.0.1 config rename is the concrete compatibility hazard. sb--prefixed config means the package looks for config/sb-*.php and silently falls back to defaults if the file is missing — an app that published under the old name gets wrong page sizes with no error. Verify composer.json Laravel/PHP constraints against the target estate's lowest supported version before sequencing any work; if any service is on an older major, the package is out of scope for that service and the "uniform envelope" goal collapses anyway.
Sequencing.
composer.json and source; confirm test suite, license, supported versions; inspect the actual JSON payload and view output.config:clear, update .env.example.Maintenance. With no adoption base, the organization becomes the de facto maintainer. Every Laravel major becomes a compatibility audit against a package nobody else is exercising, and any upstream fix must be contributed, forked, or patched locally. For a pagination library this is an unfavorable ratio: the maintenance cost of a dependency exceeds the maintenance cost of ~50 lines of first-party Blade and a resource class. Budget explicitly for this — "free" here means "unbudgeted internal ownership."
Support. No community, no issue corpus, no Q&A footprint, no vendor SLA, no documented escalation path. Support model is "a senior engineer reads the source." That is acceptable for infrastructure you control; it is poor for something as load-bearing as the paginated surface of an API, which is customer-visible.
Scaling. Pagination cost is database-bound; the package adds negligible runtime overhead. The scaling risks are structural, not throughput: the JSON metadata is serialized per row set, so non-trivial view or formatter logic would scale with page size — benchmark at page sizes of 100+ before enabling configurable large pages. Deep-offset pagination performance is unchanged by this package; it inherits all standard offset-pagination scaling limits and offers no cursor support as described.
Failure modes, ranked:
sb- config yields defaults with no error — wrong page sizes and possibly wrong query parameters in production, invisible until a customer complains. Mitigate with a startup assertion on config('sb-*.…') and a contract test that fails when the key resolves null.config:clear runs before config:cache.Ramp-up. Developer learning curve is near zero for anyone fluent in Laravel pagination, because the mental model is copy-identical to first-party pagination; integration is measured in hours. The real ramp-up cost is organizational: security review, dependency-approval exception, license check, and the standing maintenance commitment. Those gates are where the time goes, and they are disproportionately expensive for a 0-star package whose functionality is already in the framework. Total cost of ownership is dominated by governance and ownership risk, not engineering effort — which is exactly why the recommendation is to keep native pagination and, if the view standardization is genuinely wanted, copy the templates.
How can I help you explore Laravel packages today?