承接 amattu2/nhtsa-wrapper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amattu2/nhtsa-wrapper

最新稳定版本:v1.1.0

Composer 安装命令:

composer require amattu2/nhtsa-wrapper

包简介

A simple PHP based NHTSA (U.S. Department of Transportation) vehicle VIN decoder and Recall lookup API wrapper.

README 文档

README

This is a simple VIN decoder wrapper for the NHTSA (United States Department of Transportation) VIN decoder API. Additionally, it includes the NHTSA vehicle recall API. See usage section below or the example index.php file.

Usage

Import

Install with composer

require amattu2/nhtsa-wrapper
require "vendor/autoload.php";

VIN Decode

Raw Decode

PHPDoc

/**
 * Decode a 17-digit VIN
 *
 * @param string vin number
 * @param ?integer model year
 * @return ?array raw NHTSA result
 * @throws TypeError
 * @author Alec M. <https://amattu.com>
 * @date 2021-04-04T16:19:40-040
 */

Usage

$decode = amattu2\NHTSA\Client::decodeVIN("VIN_NUMBER");

Success return result

Array
(
  [Error Text] =>
  [Make] =>
  [Manufacturer Name] =>
  [Model] =>
  [Model Year] =>
  [Plant City] =>
  [Series] =>
  [Trim] =>
  [Vehicle Type] =>
  [Plant Country] =>
  ...
)

Pretty Decode

PHPDoc

/**
* Parse a raw decode call
* Converts a decodeVIN call into a pretty parsed Year, Make, Model, Trim, Engine array
*
* @param array raw decode result
* @return ?array pretty parsed NHTSA result
* @throws TypeError
* @author Alec M. <https://amattu.com>
* @date 2021-04-04T16:52:15-040
*/

Usage

$decode = amattu2\NHTSA\Client::decodeVIN("VIN_NUMBER");
$pretty_decode = amattu2\NHTSA\Client::parseDecode($decode);

Success return result (Example)

Array
(
  [Model_Year] => 2011
  [Make] => MERCEDES-BENZ
  [Model] => M-CLASS
  [Trim] =>  4-MATIC
  [Engine] => 3.5L 6-CYL (3,500CC)
)

Recalls

Raw Recalls

PHPDoc

/**
 * Get vehicle recalls by Year, Make, Model
 *
 * @param int model year
 * @param string make
 * @param string model
 * @return ?array NHTSA raw result
 * @throws TypeError
 * @author Alec M. <https://amattu.com>
 * @date 2021-04-04T16:48:24-040
 */

Usage

$recalls = amattu2\NHTSA\Client::getRecalls(2015, "Ford", "Mustang");

Success return result

Array
(
  [0] => Array
  (
      [Manufacturer] =>
      [NHTSACampaignNumber] =>
      [ReportReceivedDate] =>
      [Component] =>
      [Summary] =>
      [Conequence] =>
      [Remedy] =>
      [Notes] =>
      [ModelYear] =>
      [Make] =>
      [Model] =>
  )
  ...
)

Pretty Recalls

PHPDoc

/**
 * Parse a raw recall result
 *
 * @param array raw recall result
 * @return ?array parsed recall result
 * @throws TypeError
 * @author Alec M. <https://amattu.com>
 * @date 2021-04-04T18:16:26-040
*/

Usage

$recalls = amattu2\NHTSA\Client::getRecalls(2015, "Ford", "Mustang");
$pretty_recalls = amattu2\NHTSA\Client::parseRecalls($recalls);

Success return result

Array
(
  [2] => Array
  (
    [Campaign_Number] =>
    [Component] => Array
    (
      [0] => FUEL SYSTEM, GASOLINE
      [1] => STORAGE
      [2] => TANK ASSEMBLY /* The last element is the actual component */
    )
    [Date] => 2015-06-02
    [Description] =>
    [Remedy] =>
  )
  ...
)

getModelsForMakeByYear

PHPDoc

/**
 * Get all available models for a make by year
 *
 * @note This is a free-text match. Recommend using `getModelsForMakeIdByYear`
 * @param int $year The model year
 * @param string $make The make
 */

Usage

$models = amattu2\NHTSA\Client::getModelsForMakeByYear(2015, "Ford");

Success return result

Array
(
  [0] => Array
  (
    [Make_ID] => 441
    [Make_Name] => FORD
    [Model_ID] => 2021
    [Model_Name] => C-MAX
  )
  ...
)

getModelsForMakeIdByYear

PHPDoc

/**
 * Get all available models for a make by year
 *
 * @param int $year The model year
 * @param int $make_id The make ID
 */

Usage

$models = amattu2\NHTSA\Client::getModelsForMakeIdByYear(2015, 441);

Success return result

Array
(
  [0] => Array
  (
    [Make_ID] => 441
    [Make_Name] => FORD
    [Model_ID] => 2021
    [Model_Name] => C-MAX
  )
  ...
)

getModelsForMake

PHPDoc

/**
 * Get all available models for a make
 *
 * @param string $make The make
 */

Usage

$models = amattu2\NHTSA\Client::getModelsForMake("Ford");

Success return result

Array
(
  [0] => Array
  (
    [Make_ID] => 441
    [Make_Name] => FORD
    [Model_ID] => 2021
    [Model_Name] => C-MAX
  )
  ...
)

getModelsForMakeId

PHPDoc

/**
 * Get all available models for a make
 *
 * @param int $make_id The make ID
 */

Usage

$models = amattu2\NHTSA\Client::getModelsForMakeId(441);

Success return result

Array
(
  [0] => Array
  (
    [Make_ID] => 441
    [Make_Name] => FORD
    [Model_ID] => 2021
    [Model_Name] => C-MAX
  )
  ...
)

Requirements & Dependencies

  • PHP 7.4+
  • cURL Extension

统计信息

  • 总下载量: 551
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0
  • 更新时间: 2023-03-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固