PHP code example of webforge / accounting

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

    

webforge / accounting example snippets


$price = new Price(4284, Price::GROSS, 0.19);

$this->assertEquals(4284, $price->getGross());
$this->assertEquals(3600, $price->getNet());
$this->assertEquals(0.19, $price->getTax());
$this->assertEquals(684, $price->getTaxValue()); // = 4284-3600

// or construct it the other way round:
$price = new Price(3600, Price::NET, 0.19);
$this->assertEquals(4284, $price->getGross());
$this->assertEquals(3600, $price->getNet());
$this->assertEquals(0.19, $price->getTax());
$this->assertEquals(684, $price->getTaxValue()); // = 4284-3600

$price = new Price(4284, Price::GROSS, Price::NO_TAXES);

$this->assertEquals(4284, $price->getGross());
$this->assertEquals(4284, $price->getNet());
$this->assertEquals(0, $price->getTax());
$this->assertEquals(0, $price->getTaxValue());