PHP code example of phdevutils / bir

1. Go to this page and download the library: Download phdevutils/bir 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/ */

    

phdevutils / bir example snippets


use PhDevUtils\Bir\{Vat, PercentageTax, IncomeTax, Ewt, Forms};

// VAT
Vat::add(1000.0);           // ['gross' => 1120.0, 'net' => 1000.0, 'vat' => 120.0, …]
Vat::extract(1120.0);       // ['gross' => 1120.0, 'net' => 1000.0, 'vat' => 120.0, …]
Vat::isRegistrationRequired(3_500_000.0); // true (above ₱3M threshold)

// Percentage tax — date-aware
PercentageTax::compute(100000.0);                    // 3,000 (3% current)
PercentageTax::compute(100000.0, '2022-06-15');      // 1,000 (1% CREATE-era)
PercentageTax::rate('2023-07-01');                   // 0.03 (revert date)

// Income tax — graduated vs 8%
IncomeTax::graduated(500000.0)['tax'];               // 42500.0
IncomeTax::eightPercent(500000.0);                   // ['tax' => 20000.0, 'eligible' => true, …]

// Expanded withholding tax (creditable) on income payments
Ewt::compute(50000.0, 'rental');                     // ['rate' => 0.05, 'tax' => 2500.0, 'net' => 47500.0, …]
Ewt::compute(100000.0, 'professional_individual');   // 10% by default (must qualify for 5%)
Ewt::compute(100000.0, 'professional_individual',
  ['swornDeclaration' => true, 'payeeAnnualGross' => 800000]); // 5%
Ewt::listCategories();                               // 8 common categories

// BIR forms reference
Forms::find('2316');
Forms::find('2550M');                       // status: 'superseded', superseded_by: '2550Q' (EOPT Act RA 11976)
Forms::list(['frequency' => 'quarterly']);  // 1701Q, 1702Q, 2550Q, 2551Q, …