-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvin.php
More file actions
87 lines (72 loc) · 3.31 KB
/
Copy pathvin.php
File metadata and controls
87 lines (72 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Decoder Driver
|--------------------------------------------------------------------------
|
| The decoder used by lookups. "nhtsa" ships with the package; register your
| own with VinManager::extend() / Vin::extend() and name it here (or override
| per call with Vin::using('your-driver')).
|
*/
'driver' => env('VIN_DRIVER', 'nhtsa'),
/*
|--------------------------------------------------------------------------
| Decoder Configuration
|--------------------------------------------------------------------------
|
| Per-driver settings, keyed by driver name (à la cache.stores / mail.mailers).
| Add a block here for each custom driver that needs configuration.
|
*/
'decoders' => [
'nhtsa' => [
// NHTSA vPIC API base URL.
'base_url' => env('VIN_BASE_URL', 'https://vpic.nhtsa.dot.gov/api'),
// HTTP timeout (seconds) per decode request.
'timeout' => (int) env('VIN_TIMEOUT', 10),
// How much of each decode to hydrate onto VehicleData:
// 'identity' — year/make/model/trim/body class/vehicle type/manufacturer
// (the ~80% set; VIN + decode status are always present)
// 'typed' — the above plus series and the engine/safety/body/plant groups
// 'full' — the above plus the raw attribute passthrough (every NHTSA field)
// 'identity' is the default: clean and cheap. Step up when you need more. Lighter
// levels skip that mapping work and cache a smaller row; changing the level changes
// the stored shape, so bump VIN_CACHE_VERSION to re-decode already-cached VINs.
'attributes' => env('VIN_ATTRIBUTES', 'identity'),
// Transient-failure retry for each decode request. NHTSA occasionally blips; the HTTP
// client retries this many times, sleeping this many milliseconds between attempts,
// before a failure surfaces as VinLookupException::requestFailed / connectionFailed.
'retry' => [
'times' => (int) env('VIN_RETRY_TIMES', 2),
'sleep' => (int) env('VIN_RETRY_SLEEP', 200),
],
],
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| A VIN's decode is immutable, so results are cached. "store" names the cache
| store to use (null = the app's default store). Bump "version" to invalidate
| every previously cached decode at once, without flushing the whole store.
|
*/
'cache' => [
'store' => env('VIN_CACHE_STORE'),
'ttl' => (int) env('VIN_CACHE_TTL', 86400),
'version' => (int) env('VIN_CACHE_VERSION', 1),
],
/*
|--------------------------------------------------------------------------
| Master Switch
|--------------------------------------------------------------------------
|
| When false, lookup() throws and tryLookup() returns null without hitting
| the network or any decoder.
|
*/
'enabled' => (bool) env('VIN_ENABLED', true),
];