listUsers(int $limit = 30, int $skip = 0): UserPage
Fetches a paginated page via
GET /users?limit={limit}&skip={skip}. Defaults match
the DummyJSON API (limit=30, skip=0). Pass
limit=0 to request every user at once — DummyJSON-specific
behaviour preserved by the connector.
Returns a UserPage DTO — a final readonly value
object with items (list<User>),
total, skip, and limit. It
implements Countable and IteratorAggregate,
so count($page) returns the page size and
foreach ($page as $user) walks the items directly.
Throws: TransportException,
ApiException, InvalidResponseException.
Try it
Try limit: 5, skip: 0 for the first 5,
limit: 5, skip: 5 for the next 5, or
limit: 0 to pull every user (DummyJSON quirk).
Consumer code
use Kayrah87\DummyJsonUserConnector\Service\UserService;
$service = UserService::create();
$page = $service->listUsers(limit: 10, skip: 0);
printf(
"showing %d of %d (skip %d)\n",
count($page),
$page->total,
$page->skip,
);
foreach ($page as $user) {
echo $user->firstName . "\n";
}