---
title: "Configuring The Bundle"
package: "PagerfantaBundle"
version: "2.x"
canonical_url: "https://www.babdev.com/open-source/packages/pagerfantabundle/docs/2.x/configuring-the-bundle"
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."
---
# Configuring The Bundle

## Default View

The default view for your application can be set with the `default_view` configuration node. This defaults to "default".

```yaml
# app/config/config.yml for Symfony Standard applications
# config/packages/babdev_pagerfanta.yaml for Symfony Flex applications
babdev_pagerfanta:
    default_view: my_view
```

## Default Twig Template

The default Twig template for Twig views in your application can be set with the `default_twig_template` configuration node. This defaults to "`@BabDevPagerfanta/default.html.twig`".

```yaml
# app/config/config.yml for Symfony Standard applications
# config/packages/babdev_pagerfanta.yaml for Symfony Flex applications
babdev_pagerfanta:
    default_view: twig
    default_twig_template: '@App/Pagerfanta/default.html.twig'
```

## Exception Strategies

By default, the bundle converts `Pagerfanta\Exception\NotValidCurrentPageException` and `Pagerfanta\Exception\NotValidMaxPerPageException` exceptions into 404 responses. If you would like to disable or change this behavior, you can change the strategies using the `exceptions_strategy` node by setting the value to "custom" for each behavior you want to change.

```yaml
# app/config/config.yml for Symfony Standard applications
# config/packages/babdev_pagerfanta.yaml for Symfony Flex applications
babdev_pagerfanta:
    exceptions_strategy:
        out_of_range_page: custom # Disables converting `Pagerfanta\Exception\NotValidMaxPerPageException` to a 404 response
        not_valid_current_page: to_http_not_found # Default behavior converting `Pagerfanta\Exception\NotValidCurrentPageException` to a 404 response
```
