PHP code example of anurat / laravel-thai-tax

1. Go to this page and download the library: Download anurat/laravel-thai-tax 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/ */

    

anurat / laravel-thai-tax example snippets


ThaiTax::netIncome(500000)->incomeTax();
// 9500 THB

ThaiTax::thaiYear(2542)
    ->netIncome(500000)
    ->incomeTax();
// 42500 THB

ThaiTax::thaiYear(2564)
    ->income(250000)
    ->income(50000)
    ->income(15000)
    ->incomeTax();
// 250 THB    

ThaiTax::thaiYear(2564)
    ->income(100000)
    ->salary(50000)
    ->bonus(50000)
    ->incomeTax();
// 41000 THB    

ThaiTax::thaiYear(2564)
    ->income([
        50000,
        50000,
        'salary' => 50000,
        'bonus' => 50000
    ])
    ->incomeTax();
// 41000 THB    

ThaiTax::thaiYear(2564)
    ->income(500000)
    ->deduction(100000)
    ->incomeTax();
// 4500 THB    

ThaiTax::thaiYear(2564)
    ->income(1000000)
    ->spouse(true)
    ->children(2)
    ->parents(3)
    ->insurancePremium(50000)
    ->incomeTax();
// 39500 THB    

ThaiTax::thaiYear(2564)
    ->income(1000000)
    ->deduction([
        'spouse' => true,
        'children' => 2,
        'parents' => 3,
        'insurancePremium' => 50000
    ])
    ->incomeTax();
// 39500 THB