Download the PHP package chuckbe/clearfacts-laravel-sdk without Composer
On this page you can find all versions of the php package chuckbe/clearfacts-laravel-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chuckbe/clearfacts-laravel-sdk
More information about chuckbe/clearfacts-laravel-sdk
Files in chuckbe/clearfacts-laravel-sdk
Package clearfacts-laravel-sdk
Short Description Laravel SDK for the Clearfacts pre-accounting platform API (GraphQL)
License MIT
Homepage https://github.com/chuckbe/clearfacts-laravel-sdk
Informations about the package clearfacts-laravel-sdk
Clearfacts Laravel SDK
A Laravel SDK for the Clearfacts pre-accounting platform API. Built on Saloon PHP with a fluent, resource-based interface for the Clearfacts GraphQL API.
Requirements
- PHP 8.2+
- Laravel 10, 11, or 12
Installation
Publish the configuration file:
Configuration
Add the following to your .env file:
See config/clearfacts.php for all available options (timeouts, retry behaviour, scopes).
Authentication (Multi-Tenant / SaaS)
Clearfacts uses OpenID Connect (Authorization Code Flow). This SDK does not handle the OIDC flow itself. Instead, use Laravel Socialite with a Clearfacts provider (or a generic OIDC Socialite driver) to obtain access tokens per tenant.
The OIDC discovery endpoint is at https://login.clearfacts.be/.well-known/openid-configuration (or https://<accountant-slug>.clearfacts.be for accountant-specific endpoints).
The configured scopes are: openid, email, profile, accountant, statistics, read_administrations, associate_read, associate_actions, journal_read, contact_read, upload_document, archive_read, archive_actions.
Once you have an access token for a tenant, set it before making API calls:
Usage
The SDK provides a fluent, resource-based API:
Administrations
Documents
Invoice types: PURCHASE, SALE, VARIOUS
Archive types: VARIOUS, PERMANENT
Supported upload formats: PDF, JPEG images, XML (Billing3/UBL.BE/E-FFF)
Customers (Business Partners)
Journals
Archive Categories
Accountant
Associates
Statistics
App Info
API Reference
Available Resources
| Resource | Method | Description |
|---|---|---|
administration |
list() |
List all administrations |
administration |
get(companyNumber) |
Get a single administration |
document |
get(id) |
Get a document by ID |
document |
upload(vatNumber, fileName, invoiceType, fileContent) |
Upload invoice to inbox |
document |
uploadArchive(vatNumber, fileName, type, category, fileContent) |
Upload file to archive |
customer |
list(companyNumber, ?offset) |
List customers/business partners (paginated) |
journal |
list(companyNumber) |
List journals for an administration |
archiveCategory |
list(vatNumber) |
Get archive categories (various + permanent) |
accountant |
get() |
Get the linked accountant |
associate |
list() |
List all associates |
associate |
groups() |
List associate groups |
associate |
add(firstName, lastName, email, type, active, language, sendActivationMail, ?associateGroups) |
Add a new associate |
associate |
edit(id, fields) |
Edit an existing associate |
statistic |
companyStatistics(type, startPeriod, endPeriod, ...) |
Get company statistics |
appInfo |
update(vatnumber, ...) |
Update app info for an administration |
Data Classes
All API responses are mapped to typed data classes in Clearfacts\Data\:
| Class | Fields |
|---|---|
Administration |
name, companyType, companyNumber, companyNumberType, vatLiable, address, slug, accountManager, emails[], language |
Accountant |
name, companyNumber, systemName, address, platformName, email, logo, favicon |
Associate |
id, firstName, lastName, email, language, type, active, associateGroups[], plainPassword |
AssociateGroup |
id, name |
BusinessPartner |
id, companyNumber, name, address, email, phone, fax |
InvoiceDocument |
file, date, comment, type, paymentState |
File |
uuid, name, amountOfPages, comment, tags[] |
Journal |
id, name, creditNote, type, default, lastDocumentNumber |
CompanyStatistic |
companyNumber, items[] |
StatisticItem |
period, value |
AppInfo |
vatnumber, emailaddress, badge, icon, imageUrl, iFrameUrl |
ArchiveCategories |
various[], permanent[] |
Category |
id, name |
Address |
streetAddress, extendedAddress, postalCode, locality, country |
Country |
iso2, name |
Email |
type, emailAddress |
Enums
| Enum | Values |
|---|---|
InvoiceType |
PURCHASE, SALE, VARIOUS |
ArchiveType |
VARIOUS, PERMANENT |
AssociateType |
ADMIN, ASSOCIATE, SUPPORT |
Language |
DUTCH (nl_BE), FRENCH (fr_BE), ENGLISH (en_BE), GERMAN (de_BE) |
PaymentState |
PAID, UNPAID |
Architecture
Multi-Tenant Setup Example
In a typical multi-tenant SaaS application, you might set the token in middleware:
Development
Tests
Tests use Orchestra Testbench and Saloon's MockClient to mock HTTP responses without hitting the real API.
Official Clearfacts API Documentation
Note: The Clearfacts API does not support GraphQL introspection. The query/mutation definitions in this SDK are based on the official documentation and schema. If Clearfacts adds or changes endpoints, the request classes in src/Api/Requests/ can be updated accordingly.
License
MIT
All versions of clearfacts-laravel-sdk with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
saloonphp/saloon Version ^3.0
saloonphp/laravel-plugin Version ^3.0