Skip to content

Commit

Permalink
Add Composer support
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Mar 9, 2023
1 parent 0ede3eb commit 9ce5594
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 128 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__/

# File Types
*.ini

/vendor/
18 changes: 18 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "amattu2/nhtsa-wrapper",
"description": "A simple PHP based NHTSA (U.S. Department of Transportation) vehicle VIN decoder and Recall lookup API wrapper.",
"type": "library",
"license": "AGPL-3.0",
"autoload": {
"psr-4": {
"amattu2\\": "src/"
}
},
"authors": [
{
"name": "Alec M.",
"email": "alecmattu1234@gmail.com"
}
],
"require": {}
}
30 changes: 26 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
<?php
/*
* Produced: Thu Mar 09 2023
* Author: Alec M.
* GitHub: https://amattu.com/links/github
* Copyright: (C) 2023 Alec M.
* License: License GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use amattu2\NHTSA;

// Files
require("NHTSA.class.php");
require("src/NHTSA.php");

// Optional VIN $_GET input
$vin = isset($_GET['vin']) && !empty($_GET['vin']) ? $_GET['vin'] : "2B3KA43R86H389824";

// Perform raw decode
echo "<h1>Perform raw decode</h1>", "<pre>";
$decode = amattu\NHTSA::decodeVIN($vin);
$decode = NHTSA::decodeVIN($vin);
print_r($decode);
echo "</pre>";

// Pretty decode + parse (Year, Make, Model, Trim, Engine)
echo "<h1>Pretty parse a raw decode</h1>", "<pre>";
print_r(amattu\NHTSA::parseDecode($decode));
print_r(NHTSA::parseDecode($decode));
echo "</pre>";

// Fetch recalls
Expand All @@ -26,4 +49,3 @@
//echo "<h1>Pretty parse raw recall request</h1>", "<pre>";
//print_r(amattu\NHTSA::parseRecalls($recalls));
//echo "</pre>";
?>
Loading

0 comments on commit 9ce5594

Please sign in to comment.