Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Extending Paginator Class


Is it possible to extend \Phalcon\Paginator\Adapter\Model, so that I could add some feature on it? If yes, what is the better way to do this? I have following class in Library folder

namespace CustomShopping\Libraries\Paginator; // CustomShopping\Libraries is registered in bootstrap file

class Paginator extends \Phalcon\Paginator\Adapter\Model
  public function __construct(){

  public function customFunction(){
      return "Hello world";

And then in my controller i used it like

$paginator = new CustomShopping\Libraries\Paginator(
        'data'  => $users,
        'limit' => $limit,
        'page'  => $page,

and in view i called it like,


I get the error CustomShopping\Libraries\Paginator not found error. Thanks for the help


Okay i have got it working myself

Pagination.php in library folder

use Phalcon\Paginator\Adapter\Model;

class Pagination extends \Phalcon\Paginator\Adapter\Model
    public function __construct(array $config){

    public function customFunction(){
        return "Hello world";

and in controller i called it like

$pagination = new \Pagination();