PHP code example of kyano-digital / wefact-php

1. Go to this page and download the library: Download kyano-digital/wefact-php 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/ */

    

kyano-digital / wefact-php example snippets


use KyanoDigital\WeFact\WeFact;

$wefact = new WeFact(apiKey: 'your-api-key-here');

use KyanoDigital\WeFact\Facades\WeFact;

WeFact::debtors()->add([
    'CompanyName' => 'Company Inc.',
    'EmailAddress' => '[email protected]',
]);

WeFact::invoices()->add([
    'DebtorCode' => 'DB10001',
    'InvoiceLines' => [
        ['Description' => 'Product', 'PriceExcl' => 150.00, 'TaxCode' => 'V21'],
    ],
]);

use KyanoDigital\WeFact\WeFact;

$wefact = new WeFact(apiKey: 'your-api-key-here');

$debtor = $wefact->debtors()->add([
    'CompanyName'  => 'Company Inc.',
    'EmailAddress' => '[email protected]',
]);

use KyanoDigital\WeFact\Exceptions\WeFactException;

try {
    WeFact::invoices()->add([...]);
} catch (WeFactException $e) {
    // Human-readable message
    $e->getMessage();

    // Array of WeFact API error strings
    $e->getApiErrors();

    // Full raw API response
    $e->getApiResponse();
}
bash
composer 
bash
php artisan vendor:publish --tag=wefact