PHP code example of manageitwa / payg-tax

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

    

manageitwa / payg-tax example snippets




namespace Your\App;

use ManageIt\PaygTax\Entities\Payee;

class Employee implements Payee
{
    // ...
}

use ManageIt\PaygTax\PaygTax;

$payer = new Payer();
$payee = new Payee();
$earning = new Earning();

$tax = PaygTax::new()
    ->setPayer($payer)
    ->setPayee($payee)
    ->setEarning($earning)
    ->getTaxWithheldAmount();



namespace Your\App;

use ManageIt\PaygTax\Entities\Payee;

class Employee implements Payee
{
    // ...

    public function getAdjustments(): array
    {
        if ($this->medicareLevyReduction) {
            return [
                new \ManageIt\PaygTax\Adjustments\October2020\MedicareLevyReduction(true, 2),
            ];
        }
    }

    // ...
}



namespace Your\App;

use ManageIt\PaygTax\Entities\TaxAdjustment;

class MyCustomOffset implements TaxAdjustment
{
    // ...

    public function isEligible(
        \ManageIt\PaygTax\Entities\Payer $payer,
        \ManageIt\PaygTax\Entities\Payee $payee,
        \ManageIt\PaygTax\Entities\TaxScale $taxScale,
        \ManageIt\PaygTax\Entities\Earning $earning
    ): bool {
        return $this->needsCustomOffset;
    }

    public function getAdjustmentAmount(
        \ManageIt\PaygTax\Entities\Payer $payer,
        \ManageIt\PaygTax\Entities\Payee $payee,
        \ManageIt\PaygTax\Entities\TaxScale $taxScale,
        \ManageIt\PaygTax\Entities\Earning $earning
    ): float {
        // Take 10 dollars away from the initial withholding
        return -10;
    }

    // ...
}