PaginationFactory
final class PaginationFactory (View source)
Creates pagination results from rows or query builders using the current request as fallback context.
Methods
__construct(ServerRequestInterface $request, int $defaultPerPage = 20, int $maxPerPage = 200)
Initializes request-derived pagination defaults and enforces the configured page-size maximum.
fromArray(array $items, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)
Slices in-memory rows and returns their page state with request-derived URL context.
fromQueryBuilder(QueryBuilder $builder, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)
Counts and fetches the requested page from a query builder with request-derived URL context.
Details
__construct
__construct(ServerRequestInterface $request, int $defaultPerPage = 20, int $maxPerPage = 200)
Initializes request-derived pagination defaults and enforces the configured page-size maximum.
fromArray
PaginationResult
fromArray(array $items, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)
Slices in-memory rows and returns their page state with request-derived URL context.
fromQueryBuilder
PaginationResult
fromQueryBuilder(QueryBuilder $builder, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)
Counts and fetches the requested page from a query builder with request-derived URL context.