PHP code example of abraovic / php-paginator

1. Go to this page and download the library: Download abraovic/php-paginator 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/ */

    

abraovic / php-paginator example snippets


# Twig Configuration
twig:
    ...
    paths:
        '%kernel.root_dir%/../vendor/abraovic/php-paginator/src/template': 'abraovic_paginate'

use abraovic\phpPaginator\Paginate;

class ... {
    function ... {
        return $this->render(
                    'some.html.twig',
                    [
                        ...,
                        'pagination' => Paginate::data(
                            $page, // current page
                            $limit, // max limit per page
                            $total, // total number of items
                            $this->get('router')->generate('_route_name', array(), true) // route link - replace _route_name with proper name
                        )
                    ]
                );
    }
}

{{ 

First: [first in some other language]
Last: [last in some other language]
bash
composer