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, 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)

// 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, …