kyano-digital / wefact-php
A complete PHP package for the WeFact API, covers all resources. Works with Laravel and plain PHP.
v1.0.10
2026-06-16 09:54 UTC
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- illuminate/support: ^11.0|^12.0|^13.0
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^4.7
- phpstan/phpstan: ^2.1
Suggests
- illuminate/support: Required for Laravel integration (^11.0+).
README
A complete PHP client for the WeFact API — covers all resources and every documented action. Works with Laravel (via ServiceProvider + Facade) and plain PHP.
Installation
composer require kyano-digital/wefact-php
Laravel setup
Laravel auto-discovers the ServiceProvider and Facade. Publish the config:
php artisan vendor:publish --tag=wefact
Add your API key to .env:
WEFACT_API_KEY=your-api-key-here
Plain PHP setup
use KyanoDigital\WeFact\WeFact; $wefact = new WeFact(apiKey: 'your-api-key-here');
Usage
Laravel
use KyanoDigital\WeFact\Facades\WeFact; WeFact::debtors()->add([ 'CompanyName' => 'Company Inc.', 'EmailAddress' => 'employee@company.inc', ]); WeFact::invoices()->add([ 'DebtorCode' => 'DB10001', 'InvoiceLines' => [ ['Description' => 'Product', 'PriceExcl' => 150.00, 'TaxCode' => 'V21'], ], ]);
Plain PHP
use KyanoDigital\WeFact\WeFact; $wefact = new WeFact(apiKey: 'your-api-key-here'); $debtor = $wefact->debtors()->add([ 'CompanyName' => 'Company Inc.', 'EmailAddress' => 'employee@company.inc', ]);
Error Handling
All methods throw WeFactException on API errors or HTTP failures.
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(); }
License
MIT — see LICENSE.
Copyright (c) 2026 Kyano Digital B.V.