Registry /
web-framework / knplabs-knp-paginator-bundle
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PaginatorInterface
✓ use Knp\Component\Pager\PaginatorInterface;
Paginate a query result in a Symfony controller.
<?php
namespace App\Controller;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
class PostController extends AbstractController
{
public function index(Request $request, PaginatorInterface $paginator)
{
$pagination = $paginator->paginate(
$this->getDoctrine()->getRepository(Post::class)->findAll(),
$request->query->getInt('page', 1),
10
);
return $this->render('post/index.html.twig', ['pagination' => $pagination]);
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
6.10.0latest on Packagist
Audit
Dependencies
No dependency data recorded yet.