kyano-digital/wefact-php

A complete PHP package for the WeFact API, covers all resources. Works with Laravel and plain PHP.

Maintainers

Package info

github.com/Kyano-digital/wefact-php

pkg:composer/kyano-digital/wefact-php

Transparency log

Statistics

Installs: 114

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.10 2026-06-16 09:54 UTC

This package is auto-updated.

Last update: 2026-07-16 09:56:12 UTC


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.