PHP Classes

CakePHP Pagination Helper Trait: Add pagination to listings generated by CakePHP

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-01-11 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 24 This week: 13All time: 10,468 This week: 13Up
Version License PHP version Categories
cakephp3-json-pagina 1.0The PHP License5PHP 5, Databases, Libraries, Design P..., T...
Description Author

This package can add pagination to listings generated by CakePHP.

It provides a trait that controller classes of CakePHP applications can use to split listings into multiple pages.

Controller class functions that perform queries to retrieve the listing query results can call the trait pagination function.

The trait provides the parameters to extract only the listing rows necessary to display on the current listing page.

Innovation Award
PHP Programming Innovation award nominee
January 2022
Nominee
Vote
Pagination is a common approach many applications use to split long listings between multiple pages.

The logic to split the listings between pages is always the same.

Therefore, this package provides a trait that many PHP applications can reuse based on the CakePHP framework.

This trait helps reduce the time necessary to develop applications with paginated listings.

Manuel Lemos
Picture of Roman Kozin
  Performance   Level  
Name: Roman Kozin <contact>
Classes: 5 packages by
Country: Ukraine Ukraine
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Details

CakePHP 3.x JSON Pagination Trait

Badges

Github All Releases Packagist

Installation

composer require kield-01/cakephp3-json-pagination && composer dump-autoload -o

How to use?

In Your AppController, You must add use JsonPaginationTrait to use the trait application-wide:

class AppController extends Controller
{

    use JsonPaginationTrait; 
}

Or You could add it only to the controller You want:

class UsersController extends Controller
{

    use JsonPaginationTrait; 
}

How to get the data?

At first, You should load Your model, which You want to use with JsonPaginationTrait or to use autoloaded by the classname:

class UsersController extends Controller
{

    use JsonPaginationTrait; 
    
    public function index()
    {
        /If You want to use custom alias, You should pass second argument/
        return $this->j_paginate($this->Users->find(), $this->Users->getTable());
        
        /Regular response with classic data alias/
        return $this->j_paginate($this->Users->find());
    }

    
}
  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Readme.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageTraits (1 file)

  Files folder image Files  /  src  /  Traits  
File Role Description
  Plain text file JsonPaginationTrait.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:24
This week:13
All time:10,468
This week:13Up
For more information send a message to info at phpclasses dot org.