Download the PHP package bajzany/paginator without Composer

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

Paginator

Nette paginator for using doctrine query

Required:

Installation

How to use into another component

For example i show you this component in bajzany/table

Register paginatorControl into constructor

/**
 * @var IPaginationControl
 */
private $paginationControl;

public function __construct(ITable $table, IPaginationControl $paginationControl, $name = NULL)
{
    parent::__construct($name);
    $this->table = $table;
    $this->paginationControl = $paginationControl;
}

Now into same file create functions renderPaginator, createComponentPaginator and getPaginationControl

public function renderPaginator()
{
    $paginatorComponent = $this->getComponent(self::PAGINATOR_NAME);
    $paginatorComponent->render();
}

/**
 * @return \Bajzany\Paginator\PaginationControl
 * @throws TableException
 */
public function createComponentPaginator()
{
    $paginator = $this->table->getPaginator();
    if (empty($paginator)) {
        throw TableException::paginatorIsNotSet(get_class($this->table));
    }

    return $this->getPaginationControl()->create($paginator);
}

/**
 * @return IPaginationControl
 */
public function getPaginationControl(): IPaginationControl
{
    return $this->paginationControl;
}

Next point is into EntityTable.php

Constructor create new instance QueryPaginator() and save this into paginator property

/**
 * @param string $entityClass
 * @param EntityManager $entityManager
 */
public function __construct(string $entityClass, EntityManager $entityManager)
{
    parent::__construct();
    $this->entityClass = $entityClass;
    $this->entityManager = $entityManager;
    $this->entityRepository = $this->getEntityManager()->getRepository($this->getEntityClass());
    $this->queryBuilder = $this->entityRepository->createQueryBuilder('e');

    $this->paginator = new QueryPaginator();

}

Important is function build into EntityTable.php

Here is queryBuilder which have function getQuery() necessarily for function $paginator->setQuery($query) Paginator return updated Query and create pagination items (1,2,3, ...)

/**
 * @param IContainer $container
 * @return ITable
 */
public function build(IContainer $container): ITable
{
    if ($this->isBuild()) {
        return $this;
    }

    $this->queryBuilder->whereCriteria($this->getWhere());
    foreach ($this->getSort() as $by => $sort) {
        $this->queryBuilder->addOrderBy($by, $sort);
    }

    $query = $this->queryBuilder->getQuery();
    $paginator = $this->getPaginator();

    if ($paginator instanceof QueryPaginator) {
        $paginator->setQuery($query);
        $query = $paginator->getQuery();
        // IT'S BECAUSE ATTACH FUNCTION IN TABLECONTROL
        $container->getComponent(TableControl::PAGINATOR_NAME);
    }

    $this->entities = $query->getResult();

    return parent::build($container);
}

In latte for rendering pagination please use control nameYourComponent:paginator

<div class="box-footer clearfix">
    {control tableEntity:paginator}
</div>

In Presenter where i have function createComponentTableEntity you can change paginator pageSize, add another items into list pagination...

public function createComponentTableEntity()
{
    $table = $this->tableFactory->createEntityTable(User::class);
    $paginator = $table->getPaginator();
    $item = $paginator->getPaginatorWrapped()->createItem();
    $item->getContent()->addHtml(Html::el('')->setText('-1 Léňa'));
    $table->getPaginator()->setPageSize(2);

    ...
    ...
    ...

    return $this->tableFactory->createComponentTable($table);
}

PaginatiorWrapped is nette Html object it's very easy edit it or adding another children


All versions of paginator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
nette/di Version ^2.4
nette/application Version ^2.4
nette/bootstrap Version ^2.4
latte/latte Version ^2.4
nette/utils Version ^2.4
doctrine/orm Version ^2.6
chomenko/route-listener Version ^1.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 bajzany/paginator contains the following files

Loading the files please wait ....