mouf/utils.common.paginable-interface
A tiny PHP interface from Mouf's common utilities for pagination. PaginableInterface lets classes expose paging info—such as offset and limit—so grids, lists, and query builders can handle page navigation uniformly. Lightweight, framework-agnostic, and easy to drop into existing PHP projects.
Architecture fit
mouf/utils.common.paginable-interface, MIT, from the Mouf/TheCodingMachine ecosystem). It declares one method — paginate($limit, $offset) — and ships no implementation, no service provider, no config, no exception types. It is a naming contract, not a pagination library.Illuminate\Contracts\Pagination\LengthAwarePaginator (items + total + perPage + currentPage), hydrated by paginate() on the query builder and rendered by $paginator->links() / API Resources. This interface returns a bare slice with no total, no page number, no cursor, and no way to signal "there is more." Treating it as the HTTP pagination contract would break Blade pagination and the standard meta/links JSON shape.Integration feasibility
composer.json platform constraint is likely ^7.0 or earlier, which Composer 2 will reject on PHP 8.1+. Expect to need a fork or --ignore-platform-reqs (the latter is not acceptable for production).Provider alias if you choose to.app/Contracts or an internal platform/contracts package, unless you are standardizing across multiple services that already speak this exact signature.Technical risk
composer audit/Dependabot will generate recurring noise in compliance reviews.Key questions
paginate() — array, iterable, or Collection? This determines every adapter's implementation.php constraint in composer.json, and does it install cleanly on PHP 8.2/8.3 under Composer 2?Stack fit
Migration path
app\Contracts\Paginable (or App\Data\Contracts\Paginable) with paginate(int $limit, int $offset): iterable. Zero dependency, no fork, no abandoned-package flag, identical semantics.<org>/paginable-interface, add PHP 8.x support and a php: >=8.1 constraint, publish to a private registry (Satis / private Packagist), and pin an exact tag. Preserve the MIT license text.Compatibility
Sequencing
->offset($offset)->limit($limit); external HTTP client adapters; an in-memory implementation for unit tests.LengthAwarePaginator (where a count is available) or CursorPaginator (for large, high-churn datasets) so controllers, Blade, and API Resources never see the internal contract.Http/, Resources/, or controllers.Rollback: because the contract is a one-file abstraction, removal is a mechanical refactor across a small number of adapters — a strong argument for inlining it rather than depending on the package.
Maintenance
Support
Scaling
Failure modes
--ignore-platform-reqs silently ships an untested combination.Recommendation: Declare the contract in-house for a single Laravel application. Fork with a pinned tag and PHP 8 support only if multiple services already implement this exact signature. In all cases, keep LengthAwarePaginator/CursorPaginator at the HTTP boundary and confine this interface to the data-access layer.
How can I help you explore Laravel packages today?