Virtualmin API
A Virtualmin API designed to run standalone or as part of a Laravel Application
Requirements:
- PHP 8.0
- A running Virtualmin server
Features:
- List Domains (Virtualmin output)
- Get Domains (User-Friendly Output)
- Change Plan
- List Plans (Virtualmin output)
- Get Plans (User-Friendly Output)
Get Domains
Framework Agnostic PHP:
use \FintechSystems\VirtualminApi\VirtualminApi;
$api = new VirtualminApi(
'hostname' => 'virtualmin.test',
'username' => 'root',
'password' => '********'
);
$api->getDomains();
Laravel App:
VirtualminApi::getDomains();
Output:
Array of all domains on a Virtualmin server.
Change Plan
Framework Agnostic PHP:
use \FintechSystems\VirtualminApi\VirtualminApi;
$api = new VirtualminApi;
$api->changePlan('example.com', 'New Plan Name);
Laravel App:
VirtualminApi::changePlan('example.com', 'New Plan Name);
Testing
We have tests! Use the command below to run the tests.
Live API calls will be made otherwise causing your tests to fail.
vendor/bin/phpunit --exclude-group=live
Coverage reports
To regenerate coverage reports:
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html=tests/coverage-report
See also .travis.yml
Changelog
Please see CHANGELOG for more information on what has changed recently.
Version Control
This application uses Semantic Versioning
Local Editing
For local editing, add this to composer.json
:
"repositories" : [
{
"type": "path",
"url": "../virtualmin-api"
}
]
Credits
Inspiration
This standalone package was inspired by video course by Marcel Pociot of BeyondCode:
PHP Package Development
Before doing the video course I had developed many versions of the same thing but it was never standalone and as a consequence over the years it was difficult to maintain and quickly use in new projects.
License
The MIT License (MIT). Please see License File for more information.