nieknijland/autoscout24-php

PHP client for AutoScout24.nl — wraps internal Next.js data endpoints into a typed API

Maintainers

Package info

github.com/NiekNijland/autoscout24-php

Homepage

Language:HTML

pkg:composer/nieknijland/autoscout24-php

Fund package maintenance!

NiekNijland

Statistics

Installs: 83

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.2 2026-04-02 23:09 UTC

This package is auto-updated.

Last update: 2026-04-02 23:10:00 UTC


README

Latest Version on Packagist Tests Total Downloads

A PHP client for AutoScout24.nl that wraps internal Next.js data endpoints into a typed API. Supports searching for cars and motorcycles, fetching listing details, and retrieving filter taxonomy data (brands, models, body types, fuel types, etc.).

Installation

You can install the package via composer:

composer require nieknijland/autoscout24-php

Usage

Search for cars

use NiekNijland\AutoScout24\AutoScout24;
use NiekNijland\AutoScout24\Data\CarSearchCriteria;
use NiekNijland\AutoScout24\Data\Filters\SharedSearchFilters;
use NiekNijland\AutoScout24\Data\SortOrder;

$client = new AutoScout24();

// Basic search with defaults
$result = $client->search(new CarSearchCriteria());

foreach ($result->listings as $listing) {
    echo "{$listing->vehicle->make} {$listing->vehicle->model} - {$listing->price->priceFormatted}\n";
}

// Search with filters
$result = $client->search(CarSearchCriteria::fromFilters(
    shared: new SharedSearchFilters(
        priceFrom: 5000,
        priceTo: 20000,
        sortOrder: SortOrder::PriceAscending,
    ),
));

Search for motorcycles

use NiekNijland\AutoScout24\Data\MotorcycleSearchCriteria;

$result = $client->search(new MotorcycleSearchCriteria());

Auto-paginate through all results

// Lazily iterate through all pages
foreach ($client->searchAll(new CarSearchCriteria(), delayMs: 200) as $listing) {
    echo "{$listing->vehicle->make} {$listing->vehicle->model}\n";
}

Get listing details

$detail = $client->getDetailBySlug('volkswagen-polo-tsi-abc123');
echo $detail->vehicle->make;          // "Volkswagen"
echo $detail->prices->public->price;  // "€ 15.990"
echo $detail->descriptionText();      // Plain text (HTML stripped)

Brands and filter options

use NiekNijland\AutoScout24\Data\VehicleType;

$brands = $client->getBrands(VehicleType::Car);
$models = $client->getModels(VehicleType::Car, $brands[0]);
$bodyTypes = $client->getFilterOptions(VehicleType::Car, 'bodyType');

Caching

Pass a PSR-16 cache to avoid refetching the build ID on every request:

$client = new AutoScout24(
    cache: $yourPsr16Cache,
    cacheTtl: 3600,
);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.