I recently started playing with the Laravel PHP framework and my god I love it! So fast and so easy.. yet you have total freedom!
Anyway I wrote my first bundle for Laravel (a bundle is something like a package you can use in multiple projects) which is an implementation of the DirectAdmin API.
You can download it from github (https://github.com/kryap/laravel-directadmin) or use the laravel artisan tool:
php artisan bundle:install directadmin
Now you only have to tell your Laravel application you want to use this bundle so add this to application/bundles.php:
return array( ... 'directadmin' => array( 'auto' => true ), ... );
You might want to change the config/settings.php default values in case you’ll just access 1 static DA server.
return array( 'host' => '127.0.0.1', 'port' => 2222, 'login' => '', 'password' => '' );
And you’re ready to play with it! Get an instance:
$da = IoC::resolve('DirectAdmin');
And fetch some DA info:
$da->set_method('get'); $da->query('/CMD_API_POP', array( 'domain' => 'domain.com', 'action' => 'list' )); $da = $da->fetch_body();
By the way, make sure you read the DirectAdmin API docs @ http://www.directadmin.com/api.html