PHP code example of mrstroz / yii2-infakt

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

    

mrstroz / yii2-infakt example snippets


'components' => [
    // ...
    'infakt' => [
        'class' => 'mrstroz\infakt\Infakt',
        'apiKey' => 'xxxxxx',
    ],
]

/** @var Infakt $inFakt */
$inFakt = Yii::$app->infakt;
$response = $inFakt->call('clients', 'POST',
    ['client' =>
        [
            'company_name' => 'Infakt biuro rachunkowe',
            'nip' => '888-888-88-88'
        ]
    ]
);

/** @var Infakt $inFakt */
$inFakt = Yii::$app->infakt;
$response = $inFakt->call('clients/xxxxxx', 'GET');

/** @var Infakt $inFakt */
$inFakt = Yii::$app->infakt;
$response = $inFakt->call('invoices', 'POST',
    ['invoice' =>
        [
            'payment_method' => 'payu',
            'client_id' => 6567050,
            'services' => [
                [
                    'name' => 'Przykładowa Usługa',
                    'gross_price' => 6623,
                    'tax_symbol' => 23
                ]
            ]
        ]
    ]
);