Download the PHP package lampager/lampager-cakephp2 without Composer
On this page you can find all versions of the php package lampager/lampager-cakephp2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lampager-cakephp2
Lampager for CakePHP 2
Rapid pagination without using OFFSET
Requirements
- PHP: ^5.6 || ^7.0
- CakePHP: ^2.10
Note
- For CakePHP 2.x, use lampager/lampager-cakephp2 (this version).
- For CakePHP 3.x, use lampager/lampager-cakephp v1.x.
- For CakePHP 4.x, use lampager/lampager-cakephp v2.x.
Installing
Move Plugin/Lampager
to the appropriate directory if necessary.
Basic Usage
Load as a plugin. See How To Install Plugins for detail.
Plugin needs to be loaded manually in app/Config/bootstrap.php
:
Next, add 'Lampager.Lampager'
to your Model class (AppModel
is preferable):
Use in one or more of the following methods:
- Use in Controller (via
LampagerBehavior
) - Use in Model (via
LampagerBehavior
)
Use in Controller
At first, your Model
class must have 'Lampager.Lampager'
enabled. Use in a
way described in the Cookbook: Pagination. Note the options that are
specific to Lampager such as forward
, seekable
, or cursor
.
Use in Model
At first, your Model
class must have 'Lampager.Lampager'
enabled. Simply use
Model::find
with lampager
. The custom find type lampager
(see
Retrieving Your Data) works in a way similar to the core find type all
with additional parameters and post processor enabled.
Classes
See also: lampager/lampager.
Name | Type | Extends | Description |
---|---|---|---|
LampagerBehavior |
Class | ModelBehavior | CakePHP behavior which handles Model::find() and PaginatorComponent::paginate() |
LampagerArrayCursor |
Class | Lampager\Contracts\Cursor |
Multi-dimensional array cursor |
LampagerPaginator |
Class | Lampager\Paginator |
Paginator implementation for CakePHP |
LampagerArrayProcessor |
Class | Lampager\ArrayProcessor |
Processor implementation for CakePHP |
LampagerColumnAccess |
Class | Multi-dimensional array accessor | |
LampagerTransformer |
Class | CakePHP query genenrator |
API
See also: lampager/lampager.
Using Model::find()
or PaginatorComponent::paginate()
is recommended. The
query is merged with CakePHP query and passed to Lampager\Query
.
LampagerPaginator::__construct()
LampagerPaginator::create()
Create a new paginator instance. These methods are not intended to be directly used in your code.
LampagerPaginator::transform()
Transform a Lampager query into a CakePHP query.
LampagerPaginator::build()
Perform configure + transform.
LampagerPaginator::paginate()
Perform configure + transform + process.
Arguments
(array)
$cursor
An associative array that contains$column => $value
. It must be all-or-nothing.- For the initial page, omit this parameter or pass an empty array.
- For the subsequent pages, pass all the parameters. The partial one is not allowed.
Return Value
e.g.,
(Default format when using Model::find()
)
LampagerTransformer::__construct()
Create a new transformer instance. This class is not intended to be directly used in your code.
Examples
This section describes the practial usages of lampager-cakephp2.
Use in Controller
The example below shows how to accept a cursor parameter from a request and
pass it through PaginatorComponent::settings
. Be sure that your Model
class
has 'Lampager.Lampager'
enabled.
And the pagination links can be output as follows:
Supported database engines
MySQL, MariaDB, PostgreSQL, and SQLite
Supported!
Microsoft SQL Server
Not supported.