ApCpanelBundle
Easy to use Cpanel API bundle, (*1)
Step 1: Download ApCpanelBundle using composer
Add ApCpanelBundle by running the command:, (*2)
``` bash
$ php composer.phar require ap/cpanel-bundle 'dev-master', (*3)
### Step 2: Register the ApCpanelBundle
Enable the bundle in the kernel:
``` php
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Ap\CpanelBundle(),
);
}
Edit your config.yml:, (*4)
ap_cpanel:
domain: yourdomain.com
whmusername: yourusername
whmhash: yourhashahahsshshshshdfasdfkjasadfasdf....
Example:
``` php
<?php, (*5)
public function someAction()
{
//..
$cpanel = $this->container->get('ap_cpanel.api');, (*6)
$accountsJson = $cpanel->listaccts()->exec();
$result = json_decode($accountsJson, TRUE);
//..
}
```, (*7)