Skip to content

Commit d21fc3f

Browse files
committed
Initial commit
0 parents  commit d21fc3f

13 files changed

+545
-0
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.editorconfig export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
composer.lock
3+
docs
4+
vendor
5+
coverage

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-vehapi` will be documented in this file
4+
5+
## 1.0.0 - 201X-XX-XX
6+
7+
- initial release

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) RJ
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Laravel Vehicle Information API
2+
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebyray/laravel-vehapi.svg?style=flat-square)](https://packagist.org/packages/codebyray/laravel-vehapi)
4+
[![Build Status](https://img.shields.io/travis/codebyray/laravel-vehapi/master.svg?style=flat-square)](https://travis-ci.org/codebyray/laravel-vehapi)
5+
[![Quality Score](https://img.shields.io/scrutinizer/g/codebyray/laravel-vehapi.svg?style=flat-square)](https://scrutinizer-ci.com/g/codebyray/laravel-vehapi)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/codebyray/laravel-vehapi.svg?style=flat-square)](https://packagist.org/packages/codebyray/laravel-vehapi)
7+
8+
Vehicle Information API is an API system for retrieving vehicle information to include, vehicle year, make, model, trim, transmission, engine and logos for vehicle makes.
9+
For more information on this service or to subscribe, please visit [Vehicle Information API](https://vehapi.com)
10+
11+
## Installation
12+
13+
You can install the package via composer:
14+
15+
```bash
16+
composer require codebyray/laravel-vehapi
17+
```
18+
19+
Then include the service provider within you `app/config/app.php`.
20+
> NOTE: If you're running Laravel 5.5+ this will be auto loaded for you.
21+
22+
``` php
23+
'providers' => [
24+
Codebyray\LaravelVehapi\LaravelVehapiServiceProvider::class
25+
];
26+
```
27+
28+
Publish the config file (optional)
29+
```bash
30+
php artisan vendor:publish --provider="Codebyray\LaravelVehapi\LaravelVehapiServiceProvider" --tag="config"
31+
```
32+
33+
## Setup .env file
34+
Add your API token & API version to your .env file:
35+
> NOTE: API version will default to v1, you DO NOT need to specify the version unless you are using a different
36+
> version of Vehicle Info API. API token is required. However, it can be entered in your .env file (recommended), or the published
37+
> config file.
38+
39+
```dotenv
40+
VEH_API_TOKEN=YOUR_VEH_API_TOKEN
41+
VEH_API_VERSION=v1
42+
```
43+
## Usage
44+
45+
Let's get all the distinct years for all the makes available
46+
```php
47+
/**
48+
* @param string $sort - optional, defaults to 'asc'
49+
*/
50+
LaravelVehapi::getAllYears($sort = 'asc');
51+
52+
// Returns associative array
53+
// This will return all years from 1899-2022
54+
$vehYears = LaravelVehapi::getAllYears($sort);
55+
56+
// Convert array to json format
57+
$vehYears = json_encode(LaravelVehapi::getAllYears($sort));
58+
```
59+
Let's get all the distinct years for all the makes available
60+
```php
61+
/**
62+
* @param $minYear - required
63+
* @param $maxYear - required
64+
* @param string $sort - optional, defaults to 'asc'
65+
*/
66+
LaravelVehapi::getYearsRange($minYear, $maxYear, $sort = 'asc');
67+
68+
// Returns associative array
69+
$vehYears = LaravelVehapi::getYearsRange('2010', '2014', 'desc');
70+
71+
// Convert array to json format
72+
$vehYears = json_encode(LaravelVehapi::getYearsRange('2010', '2014', 'desc'));
73+
```
74+
75+
### Changelog
76+
77+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
78+
79+
## Contributing
80+
81+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
82+
83+
### Security
84+
85+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
86+
87+
## Credits
88+
89+
- [RJ](https://github.com/codebyray)
90+
- [All Contributors](../../contributors)
91+
92+
## License
93+
94+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "codebyray/laravel-vehapi",
3+
"description": "Vehicle Information API Laravel Package",
4+
"keywords": [
5+
"codebyray",
6+
"laravel-vehapi"
7+
],
8+
"homepage": "https://github.com/codebyray/laravel-vehapi",
9+
"license": "MIT",
10+
"type": "library",
11+
"authors": [
12+
{
13+
"name": "CodebyRay",
14+
"email": "[email protected]",
15+
"role": "Developer"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.3|^8.0",
20+
"illuminate/support": "^7.0|^8.0"
21+
},
22+
"require-dev": {
23+
"orchestra/testbench": "^6.0",
24+
"phpunit/phpunit": "^9.5"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"Codebyray\\LaravelVehapi\\": "src"
29+
}
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"Codebyray\\LaravelVehapi\\Tests\\": "tests"
34+
}
35+
},
36+
"scripts": {
37+
"test": "vendor/bin/phpunit",
38+
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
39+
40+
},
41+
"config": {
42+
"sort-packages": true
43+
},
44+
"extra": {
45+
"laravel": {
46+
"providers": [
47+
"Codebyray\\LaravelVehapi\\LaravelVehapiServiceProvider"
48+
],
49+
"aliases": {
50+
"LaravelVehapi": "Codebyray\\LaravelVehapi\\LaravelVehapiFacade"
51+
}
52+
}
53+
}
54+
}

config/config.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* You can place your custom package configuration in here.
5+
*/
6+
return [
7+
/**
8+
* Vehicle Information API token.
9+
* You should add VEH_API_TOKEN to your .env file with your token. Your .env file should
10+
* be secured and not accessible via the web. Alternately you can input your token below.
11+
*/
12+
'veh_api_token' => env('VEH_API_TOKEN', null),
13+
14+
/**
15+
* Changing versions is easy, just change the version number below to switch between versions.
16+
*/
17+
'veh_api_version' => env('VEH_API_VERSION', 'v1'),
18+
];

phpunit.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
</phpunit>

0 commit comments

Comments
 (0)