PHP code example of componenta / http-paginate-interceptor

1. Go to this page and download the library: Download componenta/http-paginate-interceptor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

componenta / http-paginate-interceptor example snippets


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);
    }
}

count, prev, next, range, page, results

use Componenta\Interceptor\Http\Paginate;

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