2017 © Pedro Peláez
 

cakephp-plugin extended-paginator

ExtendedPaginator plugin for CakePHP

image

irongomme/extended-paginator

ExtendedPaginator plugin for CakePHP

  • Thursday, June 8, 2017
  • by irongomme
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ExtendedPaginator plugin for CakePHP

Simple plugin to extend CakePHP 3 Paginator Component, with customized and additionnals queryParams., (*1)

Installation

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require irongomme/ExtendedPaginator

Then load it in your app:, (*4)

./bin/cake plugin load ExtendedPaginator

And configure it in your controller:, (*5)

public function initialize()
{
    parent::initialize();

    $this->loadComponent('Paginator', [
        'className' => 'ExtendedPaginator.ExtendedPaginator'
    ]);
}

available options

Fields choice for paginated model

  • queryParam = fields
  • values = comma separated fields

Ex: http://myapp/articles?limit=100&fields=title,content, (*6)

Will output:, (*7)

{
    results: [
        {
            id: 1,
            title: "Lorem Ipsum",
            content: "Lorem Ipsum Lorem Ipsum Lorem Ipsum ..."
        },
        {
            ...
        }
    ]
}

Unique sorting and multiple sorting with single queryParam

  • queryParam = sort
  • values = comma separated fields, prefix with - for desc

Ex: http://myapp/articles?limit=100&sort=title,-author_id, (*8)

Will sort by title ascending, then by author_id descending., (*9)

Contain associated models

  • queryParam = contain
  • values = comma separated models, with optionnal fields selection in it, by collapsing [field1,field2,...] to model name

Ex: http://myapp/articles?limit=100&contain=authors[firstname,lastname] Ex: http://myapp/articles?limit=100&contain=authors,category[name], (*10)

If no fields are specified, all fields will be shown., (*11)

The Versions

08/06 2017

dev-master

9999999-dev

ExtendedPaginator plugin for CakePHP

  Sources   Download

The Requires

 

The Development Requires