Run DirectAdmin commands through your laravel application
You can install the package via composer:
composer require lizzy/directadmin-laravel
Add the Service Provider and Facade to your app.php
config file if you're not using Package Discovery.
// config/app.php
'providers' => [
...
Lizzy\DirectadminLaravel\DirectAdminServiceProvider::class,
...
];
'aliases' => [
...
'DirectAdmin' => Lizzy\DirectadminLaravel\DirectAdmin::class,
...
];
Publish the config file using the artisan CLI tool:
php artisan vendor:publish --provider="Lizzy\DirectadminLaravel\DirectAdminServiceProvider"
.env keys
DIRECTADMIN_HOST=""
DIRECTADMIN_DOMAIN=""
DIRECTADMIN_USERNAME=""
DIRECTADMIN_PASSWORD=""
DIRECTADMIN_CACERT="cacert.pem"
Test the connection
Directadmin::checkConnection();
Current domain Information
Directadmin::domainInformation();
List User statistics
Directadmin::UserStatistics();
List email accounts of current domain
Directadmin::emailInformation();
List system information from a DirectAdmin server
Directadmin::systemInformation();
Domain pointers
// add a new pointer
Directadmin::createDomainPointer('example.com',true);
//remove a pointer
Directadmin::removeDomainPointer('example.com',true);
- $pointer (string): The domain name to be added as a pointer.
- $alias (boolean, optional, default: true): Determines whether the pointer should be treated as an alias or not.