Support Laravel 7.x
composer require unbug4120/directadmin-api
publish config file with this command
php artisan vendor:publish --provider="Unbug4120\LaravelDirectAdmin\DirectAdminServiceProvider"
DIRECTADMIN_HOSTNAME=your-directadmin-hostname
DIRECTADMIN_PORT=2222
DIRECTADMIN_USERNAME=your-username
DIRECTADMIN_PASSWORD="your-directadmin-password"
DIRECTADMIN_SERVERIP=your-server-ip
and then don't forget to clear the config cache file with this command
php artisan config:cache
code example:
use Unbug4120\LaravelDirectAdmin\Facades\DirectAdmin;
$result = DirectAdmin::getUserList();
dd($result);
To create new account you must add Unbug4120\LaravelDirectAdmin\NewAccountParameter
class for pass the new account parameter.
use Unbug4120\LaravelDirectAdmin\Facades\DirectAdmin;
use Unbug4120\LaravelDirectAdmin\NewAccountParameter;
$newAccount = new NewAccountParameter();
$newAccount->domain = 'new-domain.com';
$newAccount->username = 'new-username';
$newAccount->passwd = 'new-userpass';
$newAccount->package = 'yourhostpackage';
$newAccount->email = 'usermail@gmail.com';
$result = DirectAdmin::createNewAccount($newAccount);
dd($result);
use Unbug4120\LaravelDirectAdmin\Facades\DirectAdmin;
$userToDelete = 'usertodelete';
$result = DirectAdmin::deleteAccount($userToDelete);
dd($result);
use Unbug4120\LaravelDirectAdmin\Facades\DirectAdmin;
$userToSuspend = 'usertosuspend';
$result = DirectAdmin::suspendAccount($userToSuspend);
dd($result);
use Unbug4120\LaravelDirectAdmin\Facades\DirectAdmin;
$userToUnsuspend = 'usertounsuspend';
$result = DirectAdmin::unsuspendAccount($userToUnsuspend);
dd($result);
As the DirectAdmin API keeps expanding pull requests are welcomed, as are requests for specific functionality. Pull requests should in general include proper unit tests for the implemented or corrected functions.
For more information about unit testing see the README.md
in the tests folder.
This software was developed for internal use. It is shared with the general public under the permissive MIT license, without any guarantee of fitness for any particular purpose. Refer to the included LICENSE file for more details.
The project is not in any way affiliated with JBMC Software or its employees.