componenta/http-paginate-interceptor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

componenta/http-paginate-interceptor

Composer 安装命令:

composer require componenta/http-paginate-interceptor

包简介

HTTP pagination result interceptor for Componenta

README 文档

README

HTTP interceptor for componenta/interceptor that turns PaginatorInterface into Componenta\Http\ResourcePaginator with prev / next links.

Русская документация

Boundary

This package contains one attribute: #[Paginate]. The attribute itself implements InterceptorInterface, so it does not need a separate #[Intercept(...)].

It does not fetch data and does not create paginators. The route handler must return Componenta\Stdlib\PaginatorInterface.

Installation

composer require componenta/http-paginate-interceptor

Quick Start

use Componenta\Interceptor\Http\Attribute\Respond;
use Componenta\Interceptor\Http\Paginate;

final class PostController
{
    #[Respond(200, 'application/json')]
    #[Paginate]
    public function index(PostListQuery $query): PaginatorInterface
    {
        return $this->posts->list($query);
    }
}

If the result does not implement PaginatorInterface, #[Paginate] returns it unchanged.

Response Fields

By default ResourcePaginator receives:

count, prev, next, range, page, results

You can keep only selected metadata fields. results is always added automatically:

use Componenta\Interceptor\Http\Paginate;

#[Paginate(Paginate::FIELD_COUNT, Paginate::FIELD_NEXT)]
public function index(): PaginatorInterface {}

HTTP Request In Context

prev and next generation requires the current ServerRequestInterface. componenta/router-app passes the HTTP request into callable context when executing route handlers. If #[Paginate] receives a paginator without that request attribute, it throws LogicException.

Scope

#[Paginate] is restricted to Scope::HTTP.

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固