PHPackages                             fyennyi/mofh-api-client - 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. fyennyi/mofh-api-client

ActiveLibrary[API Development](/categories/api)

fyennyi/mofh-api-client
=======================

PSR-compliant MyOwnFreeHost API Client.

00PHPCI passing

Since Feb 28Pushed 2mo agoCompare

[ Source](https://github.com/Fyennyi/mofh-api-client)[ Packagist](https://packagist.org/packages/fyennyi/mofh-api-client)[ RSS](/packages/fyennyi-mofh-api-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MyOwnFreeHost API Client
========================

[](#myownfreehost-api-client)

[![Latest Stable Version](https://camo.githubusercontent.com/41aeb2dac652628d37ec1b2a4741f791a24fa47f83dc9795ac7559fa5fb7691c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6679656e6e79692f6d6f66682d6170692d636c69656e742e7376673f6c6162656c3d5061636b6167697374266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/mofh-api-client)[![Total Downloads](https://camo.githubusercontent.com/6e47b6ce77dc73104204a3dadc3e5f1f75b33df0496ff7df00ed34be5ea7acd9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6679656e6e79692f6d6f66682d6170692d636c69656e742e7376673f6c6162656c3d446f776e6c6f616473266c6f676f3d7061636b6167697374)](https://packagist.org/packages/fyennyi/mofh-api-client)[![License](https://camo.githubusercontent.com/0c7b29908ada5b9c08855c3d7df08a14749b23be8e676c46a16fed4261c2e723/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6679656e6e79692f6d6f66682d6170692d636c69656e742e7376673f6c6162656c3d4c6963656e6365266c6f676f3d6f70656e2d736f757263652d696e6974696174697665)](https://packagist.org/packages/fyennyi/mofh-api-client)[![Static Analysis](https://camo.githubusercontent.com/dc202d199a616af06766707097ac64de91d0061a19e0aa686da61cdbec691357/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4679656e6e79692f6d6f66682d6170692d636c69656e742f7068707374616e2e796d6c3f6c6162656c3d5048505374616e266c6f676f3d676974687562)](https://github.com/Fyennyi/mofh-api-client/actions/workflows/phpstan.yml)

A PSR-compliant client for interacting with the MyOwnFreeHost (MOFH) API. This library provides a structured, type-safe way to manage hosting accounts, domains, and support tickets.

Features
--------

[](#features)

- **PSR-18 Compliant**: Use any compatible HTTP client (Guzzle, Symfony, etc.).
- **PSR-17 Compliant**: Decoupled request factories.
- **PSR-3 Logging**: Built-in support for logging request/response cycles.
- **Domain Driven Design**: Separated repositories for Accounts, Domains, Support, and System.
- **Strictly Typed**: Utilizes DTOs (Data Transfer Objects) for all API interactions.

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

[](#installation)

You can install the package via Composer:

```
composer require fyennyi/mofh-api-client
```

Basic Usage
-----------

[](#basic-usage)

### Initialization

[](#initialization)

```
use Fyennyi\MofhApi\Client;
use Fyennyi\MofhApi\Connection;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory;

// Initialize dependencies
$httpClient = new GuzzleClient(['verify' => false]); // MOFH certificates are often expired
$requestFactory = new HttpFactory();
$connection = new Connection('your_api_username', 'your_api_password');

// Create the client
$mofh = new Client($connection, $httpClient, $requestFactory);
```

### Managing Accounts

[](#managing-accounts)

```
use Fyennyi\MofhApi\Dto\Account\CreateAccountRequest;
use Fyennyi\MofhApi\Dto\Support\TicketReply;

// Create a new hosting account
try {
    $request = new CreateAccountRequest(
        username: 'exampleuser',
        password: 'secure_password',
        contactEmail: 'user@example.com',
        domain: 'user.yourdomain.com',
        plan: 'MyPlan'
    );

    $response = $mofh->account->create($request);
    echo "Account created: " . $response->vPanelUsername;

} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}

// Support System: Create and Reply to tickets
$ticketId = $mofh->support->createTicket('hname_1234', 'Issue', 'Text', 'domain.com');
$mofh->support->reply(new TicketReply($ticketId, 'My response message'));

// Suspend an account
$mofh->account->suspend('hname_12345678', 'Policy violation.');
```

### Domain &amp; System Information

[](#domain--system-information)

```
// Check if a domain is available
$isAvailable = $mofh->domain->checkAvailability('test.example.com');

// Get account info by domain name
$userData = $mofh->domain->getUserByDomain('test.example.com');

// Get CNAME validation token (MD5)
$token = $mofh->system->getCnameToken('my-new-site.com');

// List available hosting packages
$packages = $mofh->system->getPackages();
foreach ($packages as $package) {
    echo "Plan: {$package->name} | Quota: {$package->diskQuota}MB\n";
}
```

Error Handling
--------------

[](#error-handling)

The library throws `Fyennyi\MofhApi\Exception\MofhException` for API-level errors or transport issues.

```
try {
    $mofh->account->remove('hname_12345678');
} catch (\Fyennyi\MofhApi\Exception\MofhException $e) {
    // Handle specific API error
}
```

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

[](#requirements)

- PHP 8.1 or higher.
- `ext-json` and `ext-simplexml` extensions.

Contributing
------------

[](#contributing)

Contributions are welcome and appreciated! Here's how you can contribute:

1. Fork the project
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

Please make sure to update tests as appropriate and adhere to the existing coding style.

License
-------

[](#license)

This library is licensed under the CSSM Unlimited License v2.0 (CSSM-ULv2). See the [LICENSE](LICENSE) file for details.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance61

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2471bdadcf4a5ea969fe763a72d03fb46525b59a7e4cedc3ed4d855029e7785?d=identicon)[ChernegaSergiy](/maintainers/ChernegaSergiy)

---

Top Contributors

[![ChernegaSergiy](https://avatars.githubusercontent.com/u/60980650?v=4)](https://github.com/ChernegaSergiy "ChernegaSergiy (59 commits)")

---

Tags

api-clientdtohosting-apimyownfreehostphppsr

### Embed Badge

![Health badge](/badges/fyennyi-mofh-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/fyennyi-mofh-api-client/health.svg)](https://phpackages.com/packages/fyennyi-mofh-api-client)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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