Code Monkey home page Code Monkey logo

laravel-vin's Introduction

Laravel VIN decoder

What is VIN?

A vehicle identification number (VIN) is a unique code, including a serial number, used by the automotive industry to identify individual motor vehicles, towed vehicles, motorcycles, scooters and mopeds, as defined in ISO 3779 (content and structure) and ISO 4030 (location and attachment).

  • What is VDS?
    • VDS is a Vehicle Descriptor Section. VDS is used to specify a type of vehicle and may include information about the model, platform, engine and transmission.
  • What is VIN?
    • VIN is a Vehicle Identification Number
  • What is VIS?
    • VIS is a Vehicle Identifier Section
  • What is WMI?
    • WMI is a World Manufacturer Identifier. The first three symbols identify the manufacturer of the car.

Installation

composer require composite/laravel-vin

In Laravel 5.5 or above the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:

'providers' => [
    ...
    /*
     * Package Service Providers...
     */
    Composite\LaravelVin\VinServiceProvider::class,
    ...
],

'aliases' => [
    ...
    'Vin' => Composite\LaravelVin\Facades\Vin::class,
    ...
],

Usage

use Composite\LaravelVin\Facades\Vin;

// validate
Vin::validate('WBA3A5C51CF256987'); // true

// parse
Vin::parse('WBA3A5C51CF256987'); // Vin object

// get information
Vin::parse('WBA3A5C51CF256987')->getWmi(); // WBA
Vin::parse('WBA3A5C51CF256987')->getVds(); // 3A5C51
Vin::parse('WBA3A5C51CF256987')->getVis(); // CF256987
Vin::parse('WBA3A5C51CF256987')->getManufacturer(); // BMW
Vin::parse('WBA3A5C51CF256987')->getRegion(); // Europe
Vin::parse('WBA3A5C51CF256987')->getCountry(); // Germany
Vin::parse('WBA3A5C51CF256987')->getModelYear(); // [2012]

// get information directly from vin
Vin::getWmi('WBA3A5C51CF256987'); // WBA
Vin::getVds('WBA3A5C51CF256987'); // 3A5C51
Vin::getVis('WBA3A5C51CF256987'); // CF256987
Vin::getManufacturer('WBA3A5C51CF256987'); // BMW
Vin::getRegion('WBA3A5C51CF256987'); // Europe
Vin::getCountry('WBA3A5C51CF256987'); // Germany
Vin::getModelYear('WBA3A5C51CF256987'); // [2012]

// to get info in an array you can call toArray() method
// or just return the object to get in json format
// or give vin number directly to toArray() method
Vin::parse('WBA3A5C51CF256987')->toArray(); // ['wmi' => 'WBA', 'vds' => '3A5C51', 'vis' => 'CF256987', 'manufacturer' => 'BMW', 'region' => 'Europe', 'country' => 'Germany', 'model_year' => [2012]]
Vin::parse('WBA3A5C51CF256987'); // {"wmi":"WBA","vds":"3A5C51","vis":"CF256987","manufacturer":"BMW","region":"Europe","country":"Germany","model_year":[2012]}
Vin::toArray('WBA3A5C51CF256987'); // ['wmi' => 'WBA', 'vds' => '3A5C51', 'vis' => 'CF256987', 'manufacturer' => 'BMW', 'region' => 'Europe', 'country' => 'Germany', 'model_year' => [2012]]

Return object structure

{
    "vin": "WBA3A5C51CF256987",
    "wmi": "WBA",
    "vds": "3A5C51",
    "vis": "CF256987",
    "manufacturer": "BMW",
    "region": "Europe",
    "country": "Germany",
    "model_year": [
        1982,
        2012
    ]
}

TODO

  • Add model query support

Credits

License

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

laravel-vin's People

Contributors

tambabence avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.