brenoroosevelt/cakephp-pagination-cache

Pagination Cache plugin for CakePHP 3.x

1.0.0 2017-01-25 18:58 UTC

This package is auto-updated.

Last update: 2024-12-16 07:38:06 UTC


README

Software License Total Downloads Latest Stable Version Build Status Coverage Status

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require brenoroosevelt/cakephp-pagination-cache

Load the plugin

Add following to your config/bootstrap.php

Plugin::load('BRPaginationCache');

Usage

Controller class

public function index()
{

		// load component with setup param
		$this->loadComponent('BRPaginationCache.PaginationCache', [
				'session' => 'posts_pagination'
		]);
		
		// restore pagination from session
		$this->PaginationCache->restore();
		
		// pagination		
		$this->set('posts', $this->paginate($this->Posts));
		
		// save pagination from session
		$this->PaginationCache->save();
}

Persisting pagination params (session)

All params are persisted using sessions. Make sure to load the Session component.