---
title: "Retrieving Views"
package: "PagerfantaBundle"
version: "2.x"
canonical_url: "https://www.babdev.com/open-source/packages/pagerfantabundle/docs/2.x/retrieving-views"
package_supported: true
version_released: true
end_of_support: "2021-12-31T23:59:59.999Z"
notice:
  - "Version 2.x of PagerfantaBundle reached end of support on 2021-12-31."
---
# Retrieving Views

You can access the Pagerfanta views through the `pagerfanta.view_factory` service, which is a `Pagerfanta\View\ViewFactoryInterface` instance. This is useful if your application does not use Twig but you still want to use Pagerfanta views for rendering pagination lists.

```php
<?php

namespace App\Service;

use Pagerfanta\Pagerfanta;
use Pagerfanta\View\ViewFactoryInterface;

final class PagerfantaService
{
    private ViewFactoryInterface $viewFactory;

    public function __construct(ViewFactoryInterface $viewFactory)
    {
        $this->viewFactory = $viewFactory;
    }

    public function render(Pagerfanta $pagerfanta, string $view, array $options = []): string
    {
        return $this->viewFactory->get($view)->render($pagerfanta, $this->createRouteGenerator($options), $options);
    }
}
```
