A Virtualmin API designed to run standalone or as part of a Laravel Application
Requirements:
- PHP 8.0
- A running Virtualmin server, using the Remote API
Features:
- List Domains (Virtualmin output)
- Get Domains (User-Friendly Output)
- Change Plan
- List Plans (Virtualmin output)
- Get Plans (User-Friendly Output)
- Create Domain
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.
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');
Example:
$api->createDomain([
// New virtual server details
'domain' => 'demo.example.com',
'desc' => 'My demo website',
'pass' => '***************',
'template' => 'WikiSuite 1',
'plan' => 'WikiSuite 1',
// Advanced options
'email' => 'contact@example.com',
'db' => 'demo_example_com',
// Enabled features
'features-from-plan' => '',
'virtualmin-tikimanager' => ''
]))
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
To regenerate coverage reports:
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html=tests/coverage-report
See also .travis.yml
Please see CHANGELOG for more information on what has changed recently.
This application uses Semantic Versioning
For local editing, add this to composer.json
:
"repositories" : [
{
"type": "path",
"url": "../virtualmin-api"
}
]
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.
Please add issues and merge requests via GitHub.
The MIT License (MIT). Please see License File for more information.