Download the PHP package snscripts/virtualmin-sdk without Composer

On this page you can find all versions of the php package snscripts/virtualmin-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package virtualmin-sdk

Virtualmin Control Panel SDK

Author Source Code Latest Version Software License

This is a PSR-2 Compliant Unofficial PHP SDK for the Virtualmin control panel which should hopefully make integrating your own systems into Virtualmin a piece of cake!

Requirements

Composer

Virtualmin SDK requires the following:

Installation

Composer

Simplest installation is via composer.

composer require snscripts/virtualmin-sdk 0.*

or adding to your projects composer.json file.

{
    "require": {
        "snscripts/virtualmin-sdk": "1.*"
    }
}

Usage

Setup

To get started you first need to define the Virtualmin class and pass in the Guzzle dependency.

use \Snscripts\Virtualmin\Virtualmin;

$Virtualmin = new Virtualmin(
    new GuzzleHttp\Client
);

Next you'll need to setup the connection to your Virtualmin Server. This requires the main account login details.

$Virtualmin->setConnection(
    'host:port',
    'user',
    'pass'
);

If you're server is running in http mode you can pass in the Virtualmin::NOSECURE constant as the fourth parameter of setConnection to disable the use of https. (Default behaviour is Virtualmin::SECURE).

$Virtualmin->setConnection(
    'host',
    'user',
    'pass',
    Virtualmin::NOSECURE
);

If you are running https on but it's in a development environment and doesn't actually have a valid SSL certificate, you can disable the checking of the certificate with:

$Virtualmin->setVerify(Virtualmin::NOVERIFY);

THIS SHOULD NOT BE DONE IN PRODUCTION AND IS TO ONLY BE USED DURING DEVELOPMENT IF NEEDED

Using

When using the SDK you may find this page from the Virtualmin Documentation useful. It details what actions and parameters are available on the Command Line Tool for managing your Virtualmin Server. All these commands and parameters are transferrable to this SDK (Not all commands supported yet).

Each supported section of the API comes with a "Manager" class, this class defines all the available actions for. It then also accepts any parameters needed for that request and then runs it.

Each Manager class should accept the Virtualmin object defined from the Virtualmin class, used in the examples above.

PlanManager

The plan manager is responsible for handling the Plans Related actions.

$PlanManager = new \Snscripts\Virtualmin\Plans\PlanManager($Virtualmin);
$plans = $PlanManager->ListPlans()->run();
$Plan = $plans->first(); // get the first plan returned

The ListPlans action will return a Collection of results (or an empty collection if no plans created). Each item in the Collection should be an instance of \Snscripts\Virtualmin\Plans\Plan containing the required details for that plan.

HostingManager

The Hosting Manager is responsible for handling the "Virtual Servers" or Shared Hosting accounts.

$HostingManager = new \Snscripts\Virtualmin\Hosting\HostingManager($Virtualmin);

$createResult = $HostingManager->CreateService()
    ->setDomain('example.com')
    ->setPlan($Plan->id)
    ->setPass('password')
    ->setLimitsFromPlan() // this makes it use the disk quota and broadband limits from the set plan otherwise define your own
    ->setFeaturesFromPlan() // this makes it use the defined features on your plan otherwise define your own.
    ->run();

$createResult will contain an instance of \Snscripts\Virtualmin\Results\Result. With that object you can do $createResult->getStatus() to retrieve a boolean true / false representation of whether the call was successful or not and $createResult->getMessage() to retrieve a verbose reason for the call failing or a success message.

$deleteResult = $HostingManager->DeleteService()
    ->setDomain('example.com')
    ->run();

$disableResult = $HostingManager->DisableService()
    ->setDomain('example.com')
    ->run();

$enableResult = $HostingManager->EnableService()
    ->setDomain('example.com')
    ->run();

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.


All versions of virtualmin-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
guzzlehttp/guzzle Version 6.2.*
cartalyst/collections Version 1.1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package snscripts/virtualmin-sdk contains the following files

Loading the files please wait ....