Download the PHP package vkr/pager-bundle without Composer

On this page you can find all versions of the php package vkr/pager-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pager-bundle

About

This is a simple pager bundle for Symfony. Unlike some other pagers, it is purely front-end agnostic and is written in SOA manner - you write your own service, then you get that service and Pager service from the controller, and then you get all the pagination data you need for later usage in the view layer.

This bundle depends upon VKRSettingsBundle, please read its docs before using it.

Installation

There is almost nothing to do except enabling the bundle in Composer and AppKernel.php. However, if you want to use settings-based records per page, you will need to create a setting for every instance of pager you invoke. Read VKRSettingsBundle documentation for specifics on creating settings.

Usage

Parser

There is a sole public method called . In order to use it, you need to write a parser that implements . This interface has a method called that should return the total number of records that can be shown using the pager. Here is an example of a parser class.

Take a note that this query can be really slow on big chunks of data, so try to use aggregate functions and indexing.

Using additional arguments

If your implementation of needs an argument, you have two options. You can either pass it as a class property, or use an optional $additionalArguments array, that is passed as fourth argument to from the controller - this way is recommended for use cases when you do not need the query results anywhere else and you are registering your parser class as a service.

Parser:

Controller:

Controller

Add this to your controller:

If you want to disable pagination and show all results on a single page, use

One more way to use is to define a setting for easier customization of . If you have such a setting, you can use it as a third argument:

The resulting object is an in-memory entity with the following properties:

These properties are accessible via standard getters ( etc).

Note that there are no actual records here, because this bundle does not make any DB queries. You need to write a class that would transform this data into a query.

Views

You need to manually pass the resulting array to the view. This bundle does not help you to display things, so it can be used with any templating technique. There is a small example showing how it can be used in Twig at , it includes some Twitter Bootstrap classes.

If you are using Twig, you can also use a custom filter called that is included in the bundle. It appends page attribute to the query string.

API

void Pager::__construct(VKR\SettingsBundle\SettingsRetriever $settingsRetriever)

VKR\PagerBundle\Entity\Perishable\PagerProps Pager::getPagerProps(VKR\PagerBundle\Interfaces\PageableInterface $parser, string $requestUri, int|string $recordsPerPageData, array $additionalArguments = [])

If the third argument is a string, it is interpreted as a setting name, if it is integer, it is considered to be an actual number of records per page.

int PageableInterface::getNumberOfRecords(array $additionalArguments = [])

Gets the total number of records that can possibly be displayed in this view.

Also, there are getters and setters on VKR\PagerBundle\Entity\Perishable\PagerProps entity that are omitted for the sake of brevity.


All versions of pager-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
symfony/symfony Version ~2.8|~3.0
vkr/settings-bundle Version ~1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vkr/pager-bundle contains the following files

Loading the files please wait ....