final class PaginationComponent (View source)

Provides the application-facing entry point for creating and rendering pagination.

Methods

Initializes the component with the request-aware factory and shared renderer.

fromArray(array $items, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)

Paginates in-memory rows using an explicit page or the current request's page parameter.

fromQueryBuilder(QueryBuilder $builder, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)

Paginates database rows using an explicit page or the current request's page parameter.

string

Renders a pagination result or state, returning an empty string when no state is supplied.

string

Details

__construct

__construct(PaginationFactory $factory, PaginationRenderer $renderer)

Initializes the component with the request-aware factory and shared renderer.

Parameters

PaginationFactory $factory
PaginationRenderer $renderer

fromArray

PaginationResult fromArray(array $items, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)

Paginates in-memory rows using an explicit page or the current request's page parameter.

Parameters

array $items
int|null $page
int|null $perPage
string $pageName
string|null $basePath
array|null $query

Return Value

PaginationResult

fromQueryBuilder

PaginationResult fromQueryBuilder(QueryBuilder $builder, int|null $page = null, int|null $perPage = null, string $pageName = 'page', string|null $basePath = null, array|null $query = null)

Paginates database rows using an explicit page or the current request's page parameter.

Parameters

QueryBuilder $builder
int|null $page
int|null $perPage
string $pageName
string|null $basePath
array|null $query

Return Value

PaginationResult

render

string render(PaginationResult|PaginationState|null $pagination)

Renders a pagination result or state, returning an empty string when no state is supplied.

Parameters

PaginationResult|PaginationState|null $pagination

Return Value

string