autepos/tax

Tax package for laravel

dev-main 2023-04-09 07:08 UTC

This package is auto-updated.

Last update: 2024-05-09 09:16:40 UTC


README

This package is a tax calculator for Laravel for those who like it interface.

Requirements

  • PHP 8.0+
  • Laravel 9.x+

Installation

Install the package via composer:

composer require autepos/tax

php artisan migrate

Simple usage

use Autepos\Tax\Contracts\TaxableDevice;
use Autepos\Tax\Contracts\TaxCalculatorFactory;

class Order implements TaxableDevice{
    //... Implementation of certain methods require other interfaces to be implemented
}

$order = new Order();
$taxCalculator = app(TaxCalculatorFactory::class);
$taxCalculator->addTaxableDevice($order);
$taxLineList=$taxCalculator->calculate();

$totalTax=$taxLineList->totalAmount();// To be displayed as a total tax
$exclusiveTax=$taxLineList->exclusiveAmount();// To be added to the order subtotal
$inclusiveTax=$taxLineList->inclusiveAmount(); // Already included in the order subtotal