Download the PHP package data-dog/pager-bundle without Composer

On this page you can find all versions of the php package data-dog/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

Pager bundle

This paginator is different in the following ways:

Demo

The best way to see features is to see the actual demo. Just clone the bundle and run:

make

Visit http://localhost:8000 to see the paginated fake projects with custom filters and sorters.

The demo application source is available in example directory and it is a basic symfony application.

Install

First, install it with composer:

composer require data-dog/pager-bundle

Then, add it in your AppKernel bundles.

Usage

The general usage example in your controller:

All you need is to construct Pagination with doctrine query builder and the request. The Pagination object acts like an array, so you can pass it to the view and iterate over paginated items.

The view:

There are twig helper functions used:

These templates may be modified in standard symfony ways, see the configuration section.

Filters

In order to filter paginated results in different kinds of ways, you may extend the code. In the controller, provide some pagination options.

Now here we have added three filters:

$languages and $spentTimeGroups will be used as filter_select options. The language options are simple and they refer to direct values, so the where statement does not need to be modified. But spent time groups are custom so we use custom options. In that case we need an applyFilter option to be set as a callable so the QueryBuilder could be modified accordingly based on our custom options.

NOTE: if you manage custom filtering, be sure to use parameters or use $qb->expr()->literal("string") to prevent SQL injections. Also if you have custom filter handler, you must manage all your filters, the default handler will not be active.

So how the view has changed:

We have used two new twig functions for filters:

These functions are rendering twig templates for our filters.

Links

In case if you need to make a link and maintain search filters and sorters applied, use the $pagination->query() function to get all the necessary url parameters and merge it with your link parameters.

The demo example handles enable and disable toggling for projects in a separate controller action and maintains all pagination properties.

Configuration

There is no necessary configuration for a general usage. But in order to customize pagination there may be global options set in app.php for example:

Templates

The default templates for filters and pagination are based on twitter bootstrap and fontawesome. You can customize them same as any other bundle template, for example:

Extending with more filters

The best way to customize your filters is to extend twig extension, or create a new extension. If we would provide many options, that would confuse people in the end, so instead we add a little boilerplate. In your bundle services.yml update parameters:

Then create a class:

And finally copy and modify the template based on your needs

Screenshots

Screenshot

Screenshot

License

The pager is free to use and is licensed under the MIT license


All versions of pager-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
symfony/framework-bundle Version 2.3 - 5.4
doctrine/orm Version ~2.3
twig/twig Version ~1.34|~2.0|~3.0
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 data-dog/pager-bundle contains the following files

Loading the files please wait ....