PHPackages                             hyperized/wefact - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hyperized/wefact

Abandoned → [hyperized/hostfact](/?search=hyperized%2Fhostfact)Library[API Development](/categories/api)

hyperized/wefact
================

Hostfact 3.0 API Implementation for Laravel

v5.0.0(2mo ago)163.1k15MITPHPPHP ^8.4CI failing

Since Jun 9Pushed 1w ago5 watchersCompare

[ Source](https://github.com/hyperized/hostfact)[ Packagist](https://packagist.org/packages/hyperized/wefact)[ RSS](/packages/hyperized-wefact/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (20)Versions (27)Used By (0)

Hostfact API v3.1 for Laravel
=============================

[](#hostfact-api-v31-for-laravel)

[![Run tests](https://github.com/hyperized/hostfact/actions/workflows/main.yml/badge.svg)](https://github.com/hyperized/hostfact/actions/workflows/main.yml)

Unofficial Laravel package for the [HostFact API v3.1](https://www.hostfact.nl/developer/api/).

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 13 and above (auto-discovery supported)

Installation
------------

[](#installation)

```
composer require hyperized/hostfact
```

Publish the configuration:

```
php artisan vendor:publish --provider="Hyperized\Hostfact\Providers\HostfactServiceProvider" --tag="config"
```

Configuration
-------------

[](#configuration)

Add these to your `.env` file:

```
HOSTFACT_URL=https://yoursite.tld/Pro/apiv2/api.php
HOSTFACT_KEY=your-api-token
HOSTFACT_TIMEOUT=20
```

Or edit `config/Hostfact.php` directly:

```
return [
    'api_v2_url'     => env('HOSTFACT_URL', 'https://yoursite.tld/Pro/apiv2/api.php'),
    'api_v2_key'     => env('HOSTFACT_KEY', 'token'),
    'api_v2_timeout' => env('HOSTFACT_TIMEOUT', 20),
];
```

Usage
-----

[](#usage)

Every controller provides a static `new()` factory that reads configuration from Laravel automatically:

```
use Hyperized\Hostfact\Api\Controllers\Product;
use Hyperized\Hostfact\Api\Entity\Product as ProductEntity;
use Hyperized\Hostfact\Api\Response\ListResponse;

$response = Product::new()->list(['searchfor' => 'hosting']);

if ($response instanceof ListResponse) {
    echo $response->pagination->totalResults . ' results';

    foreach ($response->entities as $product) {
        assert($product instanceof ProductEntity);
        echo $product->ProductName;
        echo $product->PriceExcl;
    }
}
```

For dependency injection or testing, use `fromHttpClient()`:

```
use Hyperized\Hostfact\Api\Controllers\Invoice;

$invoice = Invoice::fromHttpClient($httpClient);
$result = $invoice->show(['Identifier' => 'F0001']);
```

See the [examples/](examples/) directory for more complete usage patterns.

Typed Responses
---------------

[](#typed-responses)

All API methods return an `ApiResponse` subclass:

Response TypeWhenProperties`ShowResponse`Single entity returned`entity` (typed entity), `data` (DataBag)`ListResponse`Multiple entities returned`entities` (list of typed entities), `items` (list of DataBag), `pagination``ActionResponse`Action with no entity data (e.g. markAsPaid)—`ErrorResponse`API returned an error`errors` (list of strings)All responses share: `controller`, `action`, `status`, `date`, `isSuccess()`, `isError()`, `toArray()`.

### Typed Entities

[](#typed-entities)

Responses include typed entity objects with IDE autocompletion and strict PHP types:

```
use Hyperized\Hostfact\Api\Controllers\Invoice;
use Hyperized\Hostfact\Api\Entity\Invoice as InvoiceEntity;
use Hyperized\Hostfact\Api\Response\ShowResponse;

$response = Invoice::new()->show(['InvoiceCode' => 'F0001']);
assert($response instanceof ShowResponse);

$invoice = $response->entity;
assert($invoice instanceof InvoiceEntity);

$invoice->Identifier;      // ?int
$invoice->InvoiceCode;     // ?string
$invoice->Status;          // ?InvoiceStatus (enum)
$invoice->Date;            // ?DateTimeImmutable
$invoice->AmountExcl;      // ?string (for bcmath precision)
$invoice->Sent;            // ?bool

// Nested entities
foreach ($invoice->InvoiceLines as $line) {
    $line->Description;    // ?string
    $line->PriceExcl;      // ?string
}

// Fallback to DataBag for undocumented fields
$invoice->bag->string('SomeUndocumentedField');
```

For list responses:

```
$response = Product::new()->list(['searchfor' => 'hosting']);
assert($response instanceof ListResponse);

foreach ($response->entities as $product) {
    assert($product instanceof ProductEntity);
    echo $product->ProductCode;
    echo $product->ProductName;
}
```

Available entity classes: `Product`, `Debtor`, `Invoice`, `Domain`, `Hosting`, `Ssl`, `Vps`, `Ticket`, `Order`, `PriceQuote`, `Creditor`, `Group`. Controllers without documented fields (`Service`, `CreditInvoice`, `Handle`) return a `DataBag` as the entity.

### DataBag

[](#databag)

The raw API data is also accessible through typed methods on `DataBag`:

```
$bag->string('ProductCode')        // string
$bag->int('Identifier')            // int
$bag->float('PriceExcl')           // float
$bag->bool('AutoRenew')            // bool (handles "yes"/"no", 1/0)
$bag->nullableString('Comment')    // ?string
$bag->nullableInt('PackageID')     // ?int
$bag->nullableBool('Sent')         // ?bool
$bag->nullableDateTime('Created')  // ?DateTimeImmutable
$bag->array('Groups')              // array
$bag->bag('Subscription')          // nested DataBag
$bag->bags('InvoiceLines')         // list
$bag->has('SomeField')             // bool
$bag['ProductCode']                // mixed (ArrayAccess)
```

Available Controllers
---------------------

[](#available-controllers)

ControllerActions`CreditInvoice`show, list, add, edit, delete, partialPayment, markAsPaid, lineAdd, lineDelete, attachmentAdd, attachmentDelete, attachmentDownload`Creditor`show, list, add, edit, delete, attachmentAdd, attachmentDelete, attachmentDownload`Debtor`show, list, add, edit, checkLogin, updateLoginCredentials, generatePdf, sendEmail, attachmentAdd, attachmentDelete, attachmentDownload`Domain`show, list, add, edit, terminate, delete, getToken, lock, unlock, changeNameserver, syncWhois, editWhois, check, transfer, register, autoRenew, listDnsTemplates, getDnsZone, editDnsZone`Group`show, list, add, edit, delete`Handle`show, list, add, edit, delete, listDomain`Hosting`show, list, add, edit, terminate, delete, suspend, unsuspend, create, removeFromServer, getDomainList, emailAccountData, upDowngrade`Invoice`show, list, add, edit, delete, credit, partialPayment, markAsPaid, markAsUnpaid, sendByEmail, sendReminderByEmail, sendSummationByEmail, download, lineAdd, lineDelete, attachmentAdd, attachmentDelete, attachmentDownload, block, unblock, schedule, cancelSchedule, paymentProcessPause, paymentProcessReactivate`Order`show, list, add, edit, process, lineAdd, lineDelete`PriceQuote`show, list, add, edit, delete, sendByEmail, download, accept, decline, lineAdd, lineDelete, attachmentAdd, attachmentDelete, attachmentDownload`Product`show, list, add, edit, delete`Service`show, list, add, edit, terminate`Ssl`show, list, add, edit, terminate, request, markAsInstalled, download, reissue, renew, getStatus, resendApproverEmail, revoke, markAsUninstalled`Ticket`show, list, add, edit, delete, addMessage, changeStatus, changeOwner, attachmentDownload`Vps`show, list, add, edit, terminate, create, start, pause, restart, suspend, unsuspend, downloadAccountData, emailAccountDataDesign
------

[](#design)

This package provides a thin wrapper around the HostFact API. It does **not** validate input parameters. Consult the [HostFact API documentation](https://www.hostfact.nl/developer/api/) for accepted parameters.

Architecture:

- **Controllers** extend the abstract `Api` class and compose capability **traits** (e.g., `CanShow`, `CanList`, `CanAdd`)
- Each controller implements a corresponding **interface**
- All API methods accept `array` and return typed `ApiResponse` subclasses
- HTTP transport is handled by Guzzle 7.x

Testing
-------

[](#testing)

```
# Full test suite (PHPMD, PHPStan, PHPCS, phpmnd, PHPUnit, Infection)
composer test

# PHPUnit only
composer phpunit -- --configuration phpunit.xml.dist

# Static analysis
composer phpstan -- analyse
```

License
-------

[](#license)

MIT - see [LICENSE](LICENSE) for details.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~198 days

Recently: every ~399 days

Total

21

Last Release

83d ago

Major Versions

v2.9.2 → v3.0.02021-11-28

v3.0.2 → v4.0.02022-12-06

v4.0.0 → v5.0.02026-04-11

PHP version history (7 changes)v2.2PHP &gt;=5.3.0

v2.7.0PHP &gt;=5.6.4

v2.8.0PHP &gt;=7.1

v2.9.0PHP ^7.2.5

v3.0.0PHP ^7.4|^8.0|^8.1

v4.0.0PHP ^8.1

v5.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c854d21c83b5addf5f6c607968a353ff859d5bf8302659774d71b017f2f20d6?d=identicon)[hyperized](/maintainers/hyperized)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (251 commits)")[![mergify[bot]](https://avatars.githubusercontent.com/in/10562?v=4)](https://github.com/mergify[bot] "mergify[bot] (240 commits)")[![hyperized](https://avatars.githubusercontent.com/u/827954?v=4)](https://github.com/hyperized "hyperized (51 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (4 commits)")[![bitency](https://avatars.githubusercontent.com/u/18144539?v=4)](https://github.com/bitency "bitency (3 commits)")[![Caroga](https://avatars.githubusercontent.com/u/4005934?v=4)](https://github.com/Caroga "Caroga (3 commits)")[![nickurt](https://avatars.githubusercontent.com/u/5840084?v=4)](https://github.com/nickurt "nickurt (3 commits)")[![dvdheiden](https://avatars.githubusercontent.com/u/90568118?v=4)](https://github.com/dvdheiden "dvdheiden (2 commits)")[![casdr](https://avatars.githubusercontent.com/u/7041290?v=4)](https://github.com/casdr "casdr (2 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")[![chrisriteco](https://avatars.githubusercontent.com/u/1726119?v=4)](https://github.com/chrisriteco "chrisriteco (1 commits)")[![JensMombaerts](https://avatars.githubusercontent.com/u/3781236?v=4)](https://github.com/JensMombaerts "JensMombaerts (1 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (1 commits)")

---

Tags

hostfacthostfact-apiphpapihostfacthyperized

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hyperized-wefact/health.svg)

```
[![Health](https://phpackages.com/badges/hyperized-wefact/health.svg)](https://phpackages.com/packages/hyperized-wefact)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[hyperized/hostfact

Hostfact 3.0 API Implementation for Laravel

167.0k](/packages/hyperized-hostfact)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
