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