PHPackages                             addeeandra/vat-calculator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. addeeandra/vat-calculator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

addeeandra/vat-calculator
=========================

VAT Calculator

1.0.0(1y ago)01MITPHPPHP ^8.2|^8.3|^8.4

Since Jan 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/addeeandra/vat-calculator)[ Packagist](https://packagist.org/packages/addeeandra/vat-calculator)[ Docs](https://github.com/addeeandra/vat-calculator)[ RSS](/packages/addeeandra-vat-calculator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

VAT Calculator
==============

[](#vat-calculator)

Configurable VAT Rate &amp; Calculator

 [ ![GitHub Workflow Status (main)](https://github.com/addeeandra/vat-calculator/actions/workflows/tests.yml/badge.svg) ](https://github.com/addeeandra/vat-calculator/actions) [ ![Latest Stable Version](https://camo.githubusercontent.com/f60708a462d883c0811f6647beaddd4bda9989cb57bf8951acf6efa119ec26d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164646565616e6472612f7661742d63616c63756c61746f72) ](https://packagist.org/packages/addeeandra/paranoia)

---

Vat Calculator ID
=================

[](#vat-calculator-id)

This library is a simple VAT calculator.

What's in this library?
-----------------------

[](#whats-in-this-library)

- VAT Rule 11%
- VAT Rule 12% with custom base (e.g. 11/12)
- VAT Calculator, when given VAT Rule, you can
    - Calculate VAT of an amount (e.g. `AmountExclVat=100_000` =&gt; `11_000`)
    - Extract VAT from an amount (e.g. `AmountInclVat=111_000` =&gt; `11_000`)
    - Get total amount include VAT (e.g. `AmountExclVat=100_000` =&gt; `111_000`)
    - Get amount exclude VAT from (e.g. `AmountInclVat=111_000` =&gt; `100_000`)

Installation
------------

[](#installation)

You can install this package by simply running `composer require addeeandra/vat-calculator`

How to use
----------

[](#how-to-use)

To use this library is simple.

```
use \Addeeandra\VatCalculator\Rules;
use \Addeeandra\VatCalculator\Builders;

# To use PPN 11% Rule
$rule = new Rules\Vat12Rule();
$rule->calculate(100_000); // 11_000 (float)
$rule->calculator()->vatInAmount(111_000); // 11_000 (float)

# To use PPN 12% Rule
$rule = new Rules\Vat12Rule();
$rule->calculate(100_000); // 11_000 (float)
$rule->calculator()->vatInAmount(111_000); // 11_000 (float)
```

See [VatRuleTest](tests/Unit/VatRuleTest.php) and [VatCalculatorTest](tests/Unit/VatCalculatorTest.php) for more examples.

Need Custom VAT Rule?
---------------------

[](#need-custom-vat-rule)

You can make custom VAT Rule using `VatRuleBuilder` considering how fluid is our country's regulation.

[![image](https://camo.githubusercontent.com/94efd33a152f7eea764c19f9d315d431f02dc73130355ef1f1e9b1b798865bb4/68747470733a2f2f692e696d67666c69702e636f6d2f3967633164642e6a7067)](https://camo.githubusercontent.com/94efd33a152f7eea764c19f9d315d431f02dc73130355ef1f1e9b1b798865bb4/68747470733a2f2f692e696d67666c69702e636f6d2f3967633164642e6a7067)

```
// new VAT Rate 12% without base 11/12
$newVatRule = \Addeeandra\VatCalculator\Builders\VatRuleBuilder::make()
    ->rate(12) // 12%
    ->build();

// new VAT Rate 12% with base 15/12 which equals to 15%
$newVatRule = \Addeeandra\VatCalculator\Builders\VatRuleBuilder::make()
    ->rate(12) // 12%
    ->base(fn (int|float $amount) => $amount * 15 / 12) // whoops, it's actually 15% :)
    ->build();
```

License
-------

[](#license)

MIT License

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance43

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

483d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b9b8bc66ebb3e58073e2fc1eefc63cc206f3d2602702d2879fe07458cd16063?d=identicon)[addeeandra](/maintainers/addeeandra)

---

Top Contributors

[![addeeandra](https://avatars.githubusercontent.com/u/22489224?v=4)](https://github.com/addeeandra "addeeandra (5 commits)")

---

Tags

laravelvat-calculator

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/addeeandra-vat-calculator/health.svg)

```
[![Health](https://phpackages.com/badges/addeeandra-vat-calculator/health.svg)](https://phpackages.com/packages/addeeandra-vat-calculator)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M626](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
