mtcmedia / automotive-specs
v1.0.3
2024-09-17 06:07 UTC
Requires
- illuminate/support: ^6.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.13
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-09-17 06:08:03 UTC
README
此包提供了汽车规格API的基础结构 - 车辆估值、规格和风险评估在不同API中的应用的接口和枚举模型。
安装
composer require mtcmedia/automotive-specs
对于驱动设置,您需要设置默认驱动器的配置值。这定义在可以发布的配置文件中。
php artisan vendor:publish --provider="Mtc\AutomotiveSpecs\Providers\AutomotiveSpecProvider"
使用方法
此包并非针对独立使用,而是与实际的汽车规格驱动器(如CAP、MotorCheck等)结合使用。
系统允许注册新的驱动器
use Mtc\AutomotiveSpecs\Facades\AutoSpecs;
AutoSpecs::register('driver-name', function () {
return new MyDriver();
});
AutoSpecs 使用一个管理器,该管理器将选择在 automotive_specs.driver 值中定义的驱动器作为主要驱动器。驱动器值也可以通过 .env 文件作为 AUTOMOTIVE_SPECS_DRIVER 键设置。可以使用 AutoSpecs::setActiveDriver($driver_name) 方法设置不同的活动驱动器。
设置驱动器后,您可以在驱动器或管理器上调用方法。
- 检查驱动器是否支持功能
use \Mtc\AutomotiveSpecs\Facades\AutoSpecs; use \Mtc\AutomotiveSpecs\Contracts\CarValuationService;
$supported = AutoSpecs::supports(CarValuationService::class);
* Perform service action
use \Mtc\AutomotiveSpecs\Facades\AutoSpecs;
$supported = AutoSpecs::getCarSpecs($vrm, $mileage);
# Contributing
Please see [Contributing](CONTRIBUTING.md) for details.