PHPackages                             eresults/publicapi - 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. eresults/publicapi

ActiveLibrary

eresults/publicapi
==================

cPanel PublicAPI PHP client and cPanel PHP library

19991PHP

Since Jan 13Pushed 12y ago2 watchersCompare

[ Source](https://github.com/eResults/publicapi-php)[ Packagist](https://packagist.org/packages/eresults/publicapi)[ RSS](/packages/eresults-publicapi/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

cPanel PublicAPI PHP Repository
===============================

[](#cpanel-publicapi-php-repository)

This is the repository for the cPanel PublicAPI client written in PHP.

What's Included
---------------

[](#whats-included)

The repository contains the following items. Each of which is explained in further detail below:

- The cPanel PHP library
- The PublicAPI client class
- An examples directory
- The PHPUnit tests for the cPanel PHP library and PublicAPI client class

QuickStart Example of the PublicAPI Client
------------------------------------------

[](#quickstart-example-of-the-publicapi-client)

This quick start example illustrates:

1. Instantiating the PublicAPI client object with a configuration array.
2. Invoking the *whm\_api()* method for querying the [XML-API::version](http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DisplaycPanelWHMVersion "XML-API 'version'") function
3. Getting the version string from the response object

Code: &lt;?php

```
    // Include the autoloader
    require_once realpath( dirname(__FILE__) . '/Util/Autoload.php');

    // Make a configuration data array
    $config = array(
        'service' => array(
            'whm' => array(
                'config'    => array(
                    'host' => '10.1.4.191',
                    'user' => 'root',
                    'password' => 'rootsecret'
                ),
            ),
        ),
    );

    // Instantiate the PublicAPI client
    $cp = Cpanel_PublicAPI::getInstance($config);

    // Make a Whostmgr query
    $response = $cp->whm_api('version');

    // Print result string
    echo "WHM Version: {$response->version}\n";

?>

```

The cPanel PHP Library
----------------------

[](#the-cpanel-php-library)

The cPanel PHP library is a foundation for developers to build applications and scripts that interact with cPanel systems.

*Version 0.1.0 is compatible with PHP &gt;= 5.2*

The library is divided into components. The follow list itemizes a few of the components, and their description, that are in the library:

- **Cpanel\_Query**

    Abstract classes for creating objects that can query a cPanel system
- **Cpanel\_Service**

    Concrete and abstract classes that represent cPanel Services like Whostmgr and cPanel
- **Cpanel\_Parser**

    Classes that allow for encoding and decoding common string and data structures
- **Cpanel\_Util**

    Utility files and scripts for developing with the cPanel library
- ... and others

The PublicAPI Client Class
--------------------------

[](#the-publicapi-client-class)

PublicAPI is the moniker for cPanel's defined, client interface: A contract if you will, that presents a language agnostic set of methods for interacting with cPanel systems.

The PublicAPI PHP client class in this repository is a PHP implementation of that interface. The client supports all methods of the PublicAPI interface as well as most of the methods available in previous PHP client classes, such as the [XML-API client class](http://github.com/CpanelInc/xmlapi-php "XML-API client class on GitHub").

Examples of how to code with the PublicAPI client class can be found:

- In brief: The **QuickStart Example of the PublicAPI Client** section of this document
- In detail: The examples directory, *Cpanel/Examples/* within the repository

*Version 0.1.0 is compatible with PHP &gt;= 5.2*

Examples Directory
------------------

[](#examples-directory)

There are several example files located in *Cpanel/Examples/*. Reading *Introduction\_to\_PublicAPI.php* is a good place to start. All other examples assume that you have read it.

Each example file is a working example if you substitute your own credentials and host information.

In fact, you can even run the LivePHP example, *Using\_the\_LivePHP\_Service.php*, locally without having to download and install it respective of the LivePHP environment. This is possible due to a mock server that is part of the testing apparatus. Note: this is a very, very simple mock server and is not intended for anything other than example usage. So please, do not implement or rely on it.

Unit Tests
----------

[](#unit-tests)

Unit tests for the cPanel PHP library and the PublicAPI client class are included in the *Cpanel/Tests/* directory. They are written for use with [PHPUnit](http://www.phpunit.de) &gt;= 3.5 These test will require PHP 5.3 or greater, as they use specific Reflection functions that allow for assertions to be made on properties and methods whose visibility is *private* or *protected*.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/af19c5d7e2464c1afc38a1f87644e16c3efc90680deb9790741d4de31de1db8f?d=identicon)[NielsJanssen](/maintainers/NielsJanssen)

---

Top Contributors

[![martijngastkemper](https://avatars.githubusercontent.com/u/250662?v=4)](https://github.com/martijngastkemper "martijngastkemper (2 commits)")

### Embed Badge

![Health badge](/badges/eresults-publicapi/health.svg)

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

PHPackages © 2026

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