This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fe3cd3
commit 69171d2
Showing
5 changed files
with
188 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
.idea | ||
composer.lock | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Danny van Kooten <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Laravel VAT Rates | ||
================ | ||
|
||
Laravel VAT Rates is a small & lightweight Laravel library to grab VAT rates for any EU country. | ||
|
||
This uses jsonvat.com to obtain its data. Full details can be seen [here](https://github.com/adamcooke/vat-rates). | ||
|
||
## Installation | ||
|
||
Either [PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.6+ are required. | ||
|
||
To get the latest version of Laravel VAT Rates, simply require the project using [Composer](https://getcomposer.org): | ||
|
||
```bash | ||
$ composer require dannyvankooten/vat-rates | ||
``` | ||
|
||
Once Laravel VAT Rates is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key. | ||
|
||
* `'DvK\VatRates\VatRatesServiceProvider'` | ||
|
||
You can register the VatRates facade in the `aliases` key of your `config/app.php` file if you like. | ||
|
||
* `'VatRates' => 'DvK\VatRates\Facades\VatRates'` | ||
|
||
## Usage | ||
|
||
If you registered the facade then using an instance of the class is as easy as this. | ||
|
||
```php | ||
use DvK\VatRates\Facades\VatRates; | ||
|
||
VatRates::country( 'NL' ); // 21 | ||
VatRates::country( 'NL', 'reduced' ); // 6 | ||
``` | ||
|
||
If you'd prefer to use dependency injection, you can easily inject the class like this. | ||
|
||
|
||
```php | ||
use DvK\VatRates\VatRates; | ||
|
||
class Foo | ||
{ | ||
protected $rates; | ||
|
||
public function __construct(VatRates $rates) | ||
{ | ||
$this->rates = $rates; | ||
} | ||
|
||
public function bar() | ||
{ | ||
return $this->rates->country('NL'); | ||
} | ||
} | ||
``` | ||
|
||
By default, VAT rates are cached for 24 hours using the default cache driver. | ||
|
||
## License | ||
|
||
Laravel VAT Rates is licensed under [The MIT License (MIT)](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters