Search by

itmosoft / laravel-tax

adeelrao007

A reusable Laravel tax package with tax classes, rates, location-based rules, and inclusive or exclusive tax calculations. Supports Laravel 12 and 13.

Package info

github.com/ITMOSOFT/laravel-tax

pkg:composer/itmosoft/laravel-tax

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-04 13:04 UTC

This package is auto-updated.

Last update: 2026-11-04 13:06:22 UTC


README

Reusable tax engine for Laravel 12 and 13 / PHP 8.3+.

Features

  • Tax classes and multiple tax rates
  • Inclusive and exclusive calculations
  • Compound and non-compound rates
  • Location rules for country, region, and postal code
  • Scheduled rates and rules
  • Configurable table prefix and model classes

Install

composer require itmosoft/laravel-tax
php artisan vendor:publish --tag=itmosoft-tax-config
php artisan migrate

Create a class and rate

use ItmoSoft\Tax\Models\TaxClass;
use ItmoSoft\Tax\Models\TaxRate;
$class = TaxClass::create(['name' => 'Standard VAT', 'code' => 'standard']);
$rate = TaxRate::create(['tax_class_id' => $class->id, 'name' => 'VAT', 'rate' => 15, 'is_active' => true]);

Calculate

$result = app(\ItmoSoft\Tax\Services\TaxCalculator::class)->calculate(100, [$rate], inclusive: false);
// net: 100.00, tax: 15.00, gross: 115.00

Pass inclusive: true to extract tax from a gross amount. Rates are percentages. Compound rates apply to the running taxable base.

Resolve location rates

Create TaxRule records linking a tax class and rate. country, region, and postal_code are optional; null fields are wildcards. The resolver selects the most specific matching rule, then the highest priority. If no rule matches, rates with no rules attached are treated as defaults.

$rates = app(\ItmoSoft\Tax\Services\TaxResolver::class)->resolve($class, [
    'country' => 'PK', 'region' => 'Punjab', 'postal_code' => '60000',
]);

Boundaries

The package calculates supplied rates; it does not determine legal obligations, automatically manage exemptions, convert currencies, file returns, or provide jurisdiction-specific legal advice. Have jurisdiction rules reviewed by a qualified tax professional before production use.

Test

composer install
vendor/bin/phpunit

MIT License.