---
title: "Pagination Adapter"
package: "Pagerfanta"
version: "2.x"
canonical_url: "https://www.babdev.com/open-source/packages/pagerfanta/docs/2.x/adapter"
package_supported: true
version_released: true
end_of_support: "2022-03-31T23:59:59.999Z"
notice:
  - "Version 2.x of Pagerfanta reached end of support on 2022-03-31."
---
# Pagination Adapter

Pagerfanta defines `Pagerfanta\Adapter\AdapterInterface` which is the abstraction layer for any system to provide data to a `Pagerfanta` instance to support pagination lists.

The interface requires two methods to be implemented:

- `getNbResults`: Retrieves a count of the total number of items in the list
- `getSlice`: Retrieves the list of items in the current page of the paginated list

```php
<?php

namespace Pagerfanta\Adapter;

interface AdapterInterface
{
    /**
     * Returns the number of results for the list.
     *
     * @return int
     */
    public function getNbResults();

    /**
     * Returns an slice of the results representing the current page of items in the list.
     *
     * @param int $offset
     * @param int $length
     *
     * @return iterable
     */
    public function getSlice($offset, $length);
}
```
