Adapters

Custom Adapters

Creating Custom Adapters is easy. You can take a look at the available adapters to see how easy it is.

Please see the Pager Contract to learn more.

Available Adapters

ArrayAdapter

<?php

use SonsOfPHP\Component\Pager\Adapter\ArrayAdapter;

$adapter = new ArrayAdapter($results);

CallableAdabter

Will take any callable arguments.

<?php

use SonsOfPHP\Component\Pager\Adapter\CallableAdapter;

$adapter = new CallableAdapter(
    count: function (): int {
        // ...
    },
    slice: function (int $offset, ?int $length): iterable {
        // ...
    },
);

ArrayCollectionAdapter (doctrine/collections)

QueryBuilderAdapter (doctrine/dbal)

QueryBuilderAdapter (doctrine/orm)

Last updated

Was this helpful?