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

ActiveLibrary[API Development](/categories/api)

infinityfree/mofh-client
========================

An API client for MyOwnFreeHost in PHP

v0.10.0(3mo ago)493.5k↓33.3%291Apache-2.0PHPPHP &gt;=7.3CI failing

Since Mar 19Pushed 3mo ago8 watchersCompare

[ Source](https://github.com/InfinityFreeHosting/mofh-client)[ Packagist](https://packagist.org/packages/infinityfree/mofh-client)[ RSS](/packages/infinityfree-mofh-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (26)Used By (1)

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

[](#myownfreehost-api-client)

[![CI](https://github.com/InfinityFreeHosting/mofh-client/actions/workflows/ci.yaml/badge.svg)](https://github.com/InfinityFreeHosting/mofh-client/actions/workflows/ci.yaml)[![PHP Version](https://camo.githubusercontent.com/6a65f7c8ef69be90a15c4b4ee3229d44c66d68c843ec38348f3ce475ab0d12fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696e66696e697479667265652f6d6f66682d636c69656e74)](https://packagist.org/packages/infinityfree/mofh-client)[![Latest Version](https://camo.githubusercontent.com/f0bc82bb6af2c8000660387766209d4efae082e09d604e12da6ab1857fbae576/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e66696e697479667265652f6d6f66682d636c69656e74)](https://packagist.org/packages/infinityfree/mofh-client)[![License](https://camo.githubusercontent.com/1d494fff323f8dd3a0522cfe6a26392b548c61ba60e00eae037133db91e68753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e66696e697479667265652f6d6f66682d636c69656e74)](https://packagist.org/packages/infinityfree/mofh-client)

An API client to use the free hosting system from [MyOwnFreeHost](https://myownfreehost.net).

Important

This library is aimed at experienced PHP developers. Experience with object-oriented PHP and Composer is required.

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

[](#requirements)

- PHP 7.3 or higher
- ext-json
- ext-simplexml

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

[](#installation)

This package is best installed through Composer:

```
composer require infinityfree/mofh-client
```

Usage
-----

[](#usage)

Before you can get started, you need to get the API credentials from MyOwnFreeHost. Login to the [reseller panel](https://panel.myownfreehost.net), go to API -&gt; Setup WHM API -&gt; select the domain you want to configure. Copy the API Username and API password and set your own IP address as the Allowed IP Address (the IP address of your computer, server, or wherever you want to use this API client).

```
use InfinityFree\MofhClient\Client;

$client = new Client("", "");
```

Available Methods
-----------------

[](#available-methods)

### Account Management

[](#account-management)

- **createAccount**: Create a new hosting account.
    - `username`: A unique, 8 character identifier of the account.
    - `password`: A password to login to the control panel, FTP and databases.
    - `email`: The email address of the user.
    - `domain`: A domain name to create the account. Can be a subdomain or a custom domain.
    - `plan`: The name of the hosting plan to create the account on. Requires a hosting package to be configured through MyOwnFreeHost.
- **suspend**: Suspend a hosting account.
    - `username`: The unique, 8 character identifier of the account.
    - `reason`: A string with information about why you are suspending the account.
    - `linked`: If true, related accounts will be suspended as well.
- **unsuspend**: Reactivate a hosting account.
    - `username`: The unique, 8 character identifier of the account.
- **password**: Change the password of a hosting account.
    - `username`: The unique, 8 character identifier of the account.
    - `password`: The new password to set for the account.
- **removeAccount**: Permanently delete a hosting account. The account must be suspended first.
    - `username`: The unique, 8 character identifier of the account.
- **changePackage**: Change the hosting package of an account.
    - `username`: The unique, 8 character identifier of the account.
    - `package`: The name of the new hosting package to assign.

### Domain Operations

[](#domain-operations)

- **availability**: Check if a given domain name is available to be added to an account.
    - `domain`: The domain name or subdomain to check.
- **getUserDomains**: Get the domain names linked to a given account.
    - `username`: The VistaPanel login username (e.g. abcd\_12345678).
- **getDomainUser**: Get the information of a particular hosting domain name, including the account it's hosted on and the document root.
    - `domain`: The domain name to search for.
- **getCname**: Get the CNAME subdomain for a domain name, used for CNAME domain verification.
    - `domain`: The domain name to generate the CNAME subdomain for.

### Packages

[](#packages)

- **listPackages**: Get a list of available hosting packages from your reseller account.

### Support Tickets

[](#support-tickets)

- **createTicket**: Create a new support ticket on behalf of a user.
    - `subject`: The subject of the ticket.
    - `comments`: The body of the ticket message.
    - `domain`: The domain name on behalf of which the ticket is created.
    - `username`: The username of the account to which the ticket is assigned.
    - `ipAddress`: The IP address of the user who created the ticket.
- **replyTicket**: Add a reply to an existing support ticket.
    - `ticketId`: The ID of the ticket to reply to.
    - `comments`: The body of the reply message.
    - `username`: The username of the account to which the ticket is assigned.
    - `ipAddress`: The IP address of the user who created the reply.

Response Objects
----------------

[](#response-objects)

All API methods return a response object. Every response object has these methods:

- `isSuccessful(): bool` - Whether the API call was successful.
- `getMessage(): ?string` - The error message if the call failed, or `null` on success.

Some response objects have additional methods:

Response ClassMethodDescription`CreateAccountResponse``getVpUsername()`The VistaPanel username (e.g. `abcd_12345678`)`CreateTicketResponse``getTicketId()`The ID of the created ticket`GetUserDomainsResponse``getDomains()`Array of domain names on the account`GetDomainUserResponse``getUsername()`The account username for the domain`GetDomainUserResponse``getDocumentRoot()`The document root path`GetDomainUserResponse``getStatus()`The domain status`GetCnameResponse``getCname()`The CNAME subdomain for verification`AvailabilityResponse``isAvailable()`Whether the domain is available`ListPackagesResponse``getPackages()`Array of packages, each with `name`, `QUOTA`, `BWLIMIT`, etc.Error Handling
--------------

[](#error-handling)

There are two types of errors to handle:

### HTTP Errors

[](#http-errors)

If the API is unreachable or returns an HTTP error, a `MofhClientHttpException` is thrown:

```
use InfinityFree\MofhClient\Client;
use InfinityFree\MofhClient\Exception\MofhClientHttpException;

$client = new Client("", "");

try {
    $response = $client->createAccount('user1234', 'pass', 'user@example.com', 'example.com', 'my_plan');
} catch (MofhClientHttpException $e) {
    echo "HTTP error: " . $e->getMessage();
}
```

### API Errors

[](#api-errors)

If the HTTP request succeeds but the API returns an error, check the response:

```
$response = $client->createAccount('user1234', 'pass', 'user@example.com', 'example.com', 'my_plan');

if (!$response->isSuccessful()) {
    echo "API error: " . $response->getMessage();
}
```

Examples
--------

[](#examples)

### Create an Account

[](#create-an-account)

```
use InfinityFree\MofhClient\Client;

$client = new Client("", "");

$response = $client->createAccount(
    'abcd1234',
    'password123',
    'user@example.com',
    'userdomain.example.com',
    'my_plan'
);

if ($response->isSuccessful()) {
    echo "Created account with username: " . $response->getVpUsername();
} else {
    echo "Failed to create account: " . $response->getMessage();
}
```

### Suspend and Remove an Account

[](#suspend-and-remove-an-account)

```
// First suspend the account
$suspendResponse = $client->suspend('abcd1234', 'User requested account deletion');

if (!$suspendResponse->isSuccessful()) {
    die("Failed to suspend: " . $suspendResponse->getMessage());
}

// Then remove it
$removeResponse = $client->removeAccount('abcd1234');

if ($removeResponse->isSuccessful()) {
    echo "Account removed successfully";
} else {
    echo "Failed to remove account: " . $removeResponse->getMessage();
}
```

### Create a Support Ticket

[](#create-a-support-ticket)

```
$response = $client->createTicket(
    'Cannot access my website',
    'I am getting a 500 error when I try to visit my website.',
    'userdomain.example.com',
    'abcd_12345678',
    '192.168.1.1'
);

if ($response->isSuccessful()) {
    echo "Ticket created with ID: " . $response->getTicketId();
} else {
    echo "Failed to create ticket: " . $response->getMessage();
}
```

### Check Domain Availability

[](#check-domain-availability)

```
$response = $client->availability('newdomain.example.com');

if ($response->isAvailable()) {
    echo "Domain is available!";
} else {
    echo "Domain is already in use.";
}
```

### List Available Packages

[](#list-available-packages)

```
$response = $client->listPackages();

if ($response->isSuccessful()) {
    foreach ($response->getPackages() as $package) {
        echo $package['name'] . ": " . $package['QUOTA'] . " MB disk, " . $package['BWLIMIT'] . " MB bandwidth\n";
    }
}
```

License
-------

[](#license)

Copyright 2026 InfinityFree

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance78

Regular maintenance activity

Popularity36

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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.

###  Release Activity

Cadence

Every ~140 days

Recently: every ~265 days

Total

24

Last Release

113d ago

PHP version history (2 changes)0.8.0PHP &gt;=7.1

v0.10.0PHP &gt;=7.3

### Community

Maintainers

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

---

Top Contributors

[![Grendel7](https://avatars.githubusercontent.com/u/1823324?v=4)](https://github.com/Grendel7 "Grendel7 (45 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![pauladams8](https://avatars.githubusercontent.com/u/37362614?v=4)](https://github.com/pauladams8 "pauladams8 (2 commits)")[![greenreader9](https://avatars.githubusercontent.com/u/75644395?v=4)](https://github.com/greenreader9 "greenreader9 (1 commits)")[![BastelPichi](https://avatars.githubusercontent.com/u/63782569?v=4)](https://github.com/BastelPichi "BastelPichi (1 commits)")[![HansAdema](https://avatars.githubusercontent.com/u/174806651?v=4)](https://github.com/HansAdema "HansAdema (1 commits)")[![PlanetTheCloud](https://avatars.githubusercontent.com/u/35788716?v=4)](https://github.com/PlanetTheCloud "PlanetTheCloud (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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