PHP code example of pajkho / siephp

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

    

pajkho / siephp example snippets


// create a company
$company = (new SIE\Data\Company())
    // set company name
    ->setCompanyName('My company')
    // add a verification series
    ->addVerificationSeries(new SIE\Data\VerificationSeries())
    // add two accounts
    ->addAccount((new SIE\Data\Account(1511))->setName('Kundfordringar'))
    ->addAccount((new SIE\Data\Account(3741))->setName('Öresutjämning'))
;

// add a verification with two transactions
$verification = (new SIE\Data\Verification(591000490))->setDate('20150105')
    ->addTransaction(
        (new SIE\Data\Transaction())
            ->setAccount($company->getAccount(1511))
            ->setAmount(-0.24)
    )
    ->addTransaction(
        (new SIE\Data\Transaction())
            ->setAccount($company->getAccount(3741))
            ->setAmount(0.24)
    )
;
// add the verification to the company
$company->getVerificationSeriesAll()[0]->addVerification($verification);
// validate data, will throw Exception if invalid data
$company->validate();

$dumper = new SIE\Dumper\SIEDumper();
$output = $dumper->dump($company);
echo $output;