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

Simple Pagination Laravel Package

ashleydawson/simple-pagination

Framework-agnostic pagination library for PHP. Provide callbacks to count total items and fetch a slice (offset/length), and it returns a Pagination object with items plus page metadata and ranges. Works with arrays, DB lists, Doctrine, Solr, and more.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables rapid implementation of pagination for APIs, admin dashboards, or user-facing lists without reinventing the wheel. Ideal for projects requiring flexible, database-agnostic pagination (e.g., arrays, SQL, NoSQL, or external APIs).
  • Roadmap Prioritization: Justifies investing in a lightweight solution over custom-built pagination if the team lacks time/resources to optimize performance-critical pagination logic. Trade-off: simplicity vs. scalability for high-traffic use cases.
  • Build vs. Buy: Buy for small-to-medium projects where pagination is a secondary concern. Build only if needing advanced features (e.g., virtual scrolling, infinite scroll, or real-time updates) or if performance benchmarks show this package is a bottleneck.
  • Use Cases:
    • Legacy System Modernization: Integrate pagination into older PHP/Laravel apps without major refactoring.
    • Multi-Data-Source Apps: Unify pagination logic for APIs (REST/GraphQL), databases, and third-party services (e.g., Elasticsearch, Solr).
    • Prototyping: Quickly test pagination flows in MVPs before committing to a framework-specific solution (e.g., Laravel’s built-in pagination).

When to Consider This Package

  • Adopt If:
    • Your pagination needs are basic (standard page ranges, no infinite scroll).
    • You’re working with heterogeneous data sources (arrays, SQL, NoSQL) and want a unified approach.
    • Your team prioritizes developer velocity over micro-optimizations (e.g., no need for lazy-loading or server-side cursors).
    • You’re using Laravel but need flexibility beyond Eloquent’s built-in pagination (e.g., paginating raw API responses).
  • Look Elsewhere If:
    • Performance is critical: This package lacks optimizations like query caching or server-side cursor pagination for large datasets.
    • Framework-specific features are needed: Laravel’s built-in pagination integrates with Blade, API resources, and testing tools (e.g., PaginationFactory).
    • Advanced UX is required: Infinite scroll, virtual scrolling, or real-time updates (e.g., Livewire/Alpine.js integration) aren’t supported.
    • Maintenance is a concern: Last release was 2019; no active community or Laravel 10+ compatibility guarantees.
    • Type safety matters: PHP 8+ typed properties aren’t leveraged (e.g., getItems() returns mixed).

How to Pitch It (Stakeholders)

For Executives: "This lightweight pagination library lets us standardize pagination across all data sources—databases, APIs, and even in-memory collections—without building custom logic. It’s a 2-week implementation for a feature that would otherwise take 3x longer to develop and maintain. The trade-off is minimal: we’re prioritizing speed over ultra-low latency, which aligns with our current user traffic and roadmap. For high-scale needs, we can always replace it later."

For Engineering: *"SimplePagination is a callback-driven, framework-agnostic solution that works with any iterable collection. Key benefits:

  • Flexibility: Paginate arrays, SQL results, or third-party API responses with the same code.
  • Integration: Plays well with Laravel’s request handling (e.g., ?page=2) and can be wrapped in a service class for consistency.
  • Extensibility: Supports metadata, pre/post-query hooks, and iterators—enough to cover 80% of use cases without bloat. Downsides: No active maintenance (last update 2019) and lacks Laravel’s ecosystem integrations (e.g., API resources). Use it for non-critical pagination or as a stopgap while we evaluate Laravel’s built-in solution or a more modern package like* spatie/laravel-pagination for future projects."
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor