PHPackages                             totov/laravel-cap-hpi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. totov/laravel-cap-hpi

ActiveLibrary

totov/laravel-cap-hpi
=====================

A Laravel implementation of the Cap HPI UK API - https://api.cap-hpi.co.uk/docs/index.html

v1.1.0(2y ago)2971MITPHPPHP ^8.0

Since Jun 15Pushed 2y ago2 watchersCompare

[ Source](https://github.com/totov/laravel-cap-hpi)[ Packagist](https://packagist.org/packages/totov/laravel-cap-hpi)[ Docs](https://github.com/totov/laravel-cap-hpi)[ GitHub Sponsors](https://github.com/totov)[ RSS](/packages/totov-laravel-cap-hpi/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

A Laravel implementation of the Cap HPI UK API -
============================================================================================

[](#a-laravel-implementation-of-the-cap-hpi-uk-api---httpsapicap-hpicoukdocsindexhtml)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3fbc84384d4ba5787ec59f3a331b70dfd75fd9053dbd9b4ca722f503adc53fa1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f746f762f6c61726176656c2d6361702d6870692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/totov/laravel-cap-hpi)[![GitHub Tests Action Status](https://camo.githubusercontent.com/893bee4473203a9dbbee7d84b6d213342568dccdfe6e1a07cacdf833551baa21/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f746f762f6c61726176656c2d6361702d6870692f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/totov/laravel-cap-hpi/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Static Analysis Action Status](https://camo.githubusercontent.com/e9358262c3b7dd6fd78614ad3aa48b99d0fdfbf6c244a0463d3e2150de1200dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f746f762f6c61726176656c2d6361702d6870692f7073616c6d2e796d6c3f6c6162656c3d7073616c6d)](https://github.com/totov/laravel-cap-hpi/actions?query=workflow%3A%22Psalm%22+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1ac94ed753e3cca49f7f0ffe6b3689680bf8b5a4845b2f7d3335f9baf4b7f7c7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f746f762f6c61726176656c2d6361702d6870692f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/totov/laravel-cap-hpi/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/6f121c4940c9f3ce446af332a6ec08d8506ce906d545160cddf9265a810e9f0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f746f762f6c61726176656c2d6361702d6870692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/totov/laravel-cap-hpi)

---

Requirements
------------

[](#requirements)

- PHP ^8.0
- PHP ext-json
- Composer ^2.0

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require totov/laravel-cap-hpi
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Totov\Cap\CapServiceProvider" --tag="laravel-cap-hpi-config"
```

This is the contents of the published config file:

```
return [
    'client_id' => env('CAP_CLIENT_ID', 'null'),
    'secret' => env('CAP_SECRET', 'null'),
];
```

Usage
-----

[](#usage)

```
use Totov\Cap\Cap;
use Totov\Cap\Subsets\CurrentValuations\CurrentValuationOptions;
use Totov\Cap\Subsets\FutureValuations\FutureValuationOptions;
use Totov\Cap\Subsets\FullVehicleData\Options;

// Initialise cap with client ID and secret
$clientId = config('cap.client_id');
$secret = config('cap.secret');
$cap = new Cap($clientId, $secret);

// Or grab from the container which automatically grabs the config and creates a singleton
$cap = app(Cap::class);

// Get current API version and status
$version = $cap->version();
$status = Cap::status();

// Get full vehicle data by VRM
$currentPoints = new CurrentValuationOptions(['TradeClean'], [['mileage' => 20000]]);
$futurePoints = new FutureValuationOptions(['TradeClean'], [['mileage' => 25000, 'valuationDate' => '2021-09-19']]);
$options = new Options($currentPoints, $futurePoints);

$cap->fullVehicleData->byVrm('AB12CDE', $options);

// Look up current valuation by VRM
$options = new CurrentValuationOptions(['TradeClean'], [['mileage' => 20000]]);
$cap->currentValuations->byVrm('AB12CDE', $options);

// Look up equipment by VRM
$cap->equipment->byVrm('AB12CDE');

// Look up derivative details by VRM
$cap->derivativeDetails->byVrm('AB12CDE');

// Get vehicle details by VRM
$cap->vehicleDetails->byVrm('AB12CDE');

// Get vehicle SMMT data by VRM
$cap->smmtData->byVrm('AB12CDE');

// Get previous keepers of vehicle by VRM
$cap->vehicleKeepers->byVrm('AB12CDE');

// Look up DVLA data for vehicle by VRM
$cap->dvlaData->byVrm('AB12CDE');

// Perform flag check lookup by VRM
$cap->checkFlags->byVrm('AB12CDE');

// Get future valuation for vehicle by VRM
$options = new FutureValuationOptions(['TradeClean'], [['mileage' => 25000, 'valuationDate' => '2021-09-19']]);
$cap->futureValuations->byVrm('AB12CDE', $options);

// Get derivative image for vehicle by VRM
$response = $cap->derivativeImages->byVrm('AB12CDE');
if ($response->ok()) {
    $imageContent = $response->body();
    // ...
}

// Get latest MOT details for vehicle by VRM
$cap->motHistory->byVrm('AB12CDE', true);

// Or all MOT history for vehicle by VRM
$cap->motHistory->byVrm('AB12CDE');

// Get brands info
$cap->derivativeHierarchy->brands->byDerivativeType('cars');
$cap->derivativeHierarchy->brands->byDerivativeTypeAndBrandId('cars', 25545);

// Get ranges info
$cap->derivativeHierarchy->ranges->byDerivativeTypeAndBrandId('cars', 25545);
$cap->derivativeHierarchy->ranges->byDerivativeTypeAndRangeId('cars', 89);

// Get model info
$cap->derivativeHierarchy->models->byDerivativeTypeAndBrandId('cars', 25545);
$cap->derivativeHierarchy->models->byDerivativeTypeAndRangeId('cars', 89);
$cap->derivativeHierarchy->models->byDerivativeTypeAndModelId('cars', 25547);

// Get trim info
$cap->derivativeHierarchy->trims->byDerivativeTypeAndModelId('cars', 25547);

// Get derivatives
$cap->derivativeHierarchy->derivatives->byDerivativeTypeAndModelId('cars', 25547);
$cap->derivativeHierarchy->derivatives->byDerivativeTypeAndTrimId('cars', 10619);

// Get technical spec categories
$cap->technicalSpecification->categories->byDerivativeType('cars');
$cap->technicalSpecification->categories->byDerivativeTypeAndCategoryId('cars', 8);

// Get technical specs for vehicle by VRM
$cap->technicalSpecification->byVrm('AB12CDE');

// Get technical specs for vehicle by VRM with filter on returned items (category IDs and item IDs)
$cap->technicalSpecification->byVrm('AB12CDE', [6, 7], [33, 34, 24]);
```

Examples above use VRM, but lookups can be performed using the VIN (or a combination of VIN &amp; VRM) as per the documentation, just use `->byVin()` or `->byVinAndVRM()` instead.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Roadmap
-------

[](#roadmap)

- More in-depth testing per endpoint
- Use DataTransferObjects instead of returning JSON
- Automatically inject token into relevant requests

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Stephen Hamilton](https://github.com/totov)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~358 days

Total

3

Last Release

1075d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb7ba82ab151e43922378cd874002842f69096a548790f132a7c27c99a98b0fb?d=identicon)[totov](/maintainers/totov)

---

Top Contributors

[![totov](https://avatars.githubusercontent.com/u/2348955?v=4)](https://github.com/totov "totov (37 commits)")

---

Tags

laraveltotovlaravel-cap-hpi

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/totov-laravel-cap-hpi/health.svg)

```
[![Health](https://phpackages.com/badges/totov-laravel-cap-hpi/health.svg)](https://phpackages.com/packages/totov-laravel-cap-hpi)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[spatie/laravel-rdap

Perform RDAP queries in a Laravel app

72108.3k2](/packages/spatie-laravel-rdap)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
