PHP code example of jonczek / tax-de

1. Go to this page and download the library: Download jonczek/tax-de library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jonczek / tax-de example snippets


$repository = new GenericRepository();
$repository->add(new ValueAddedTaxEntry(119));
$repository->add(new ValueAddedTaxEntry(238));
$repository->add(new ValueAddedTaxEntry(107, ValueAddedTaxRate::REDUCED_RATE));
$repository->add(new ValueAddedTaxEntry(214, ValueAddedTaxRate::REDUCED_RATE));
$repository->add(new ValueAddedTaxEntry(100, ValueAddedTaxRate::REDUCED_RATE, true));
$repository->add(new ValueAddedTaxEntry(200, ValueAddedTaxRate::FULL_RATE, true));

$calculator = new ValueAddedTaxCalculator();
$result = $calculator->calculate($repository);

Jonczek\Tax\Model\ValueAddedTaxCalculationResult Object
(
    [net:protected] => 900
    [gross:protected] => 1023
    [tax:protected] => 123
)