arpanadhikari/virtualmin-sdk
Composer 安装命令:
composer require arpanadhikari/virtualmin-sdk
包简介
Unofficial SDK for Virtualmin Control Panel. Fork of snscripts/virtualmin-sdk
关键字:
README 文档
README
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:
- "php": ">=5.5.0
- "guzzlehttp/guzzle": "6.5.*",
- "cartalyst/collections": "1.1.*"
Installation
Composer
Simplest installation is via composer.
composer require arpanadhikari/virtualmin-sdk 0.*
or adding to your projects composer.json file.
{
"require": {
"arpanadhikari/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.
arpanadhikari/virtualmin-sdk 适用场景与选型建议
arpanadhikari/virtualmin-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sdk」 「virtualmin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arpanadhikari/virtualmin-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arpanadhikari/virtualmin-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arpanadhikari/virtualmin-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GUI for managing languages and translations in appui
Unofficial SDK for Virtualmin Control Panel
Interface with the VirtualMin HTTP API
Provides an interface for accessing Virtualmin's API
PHP SDK for the Enconvert file conversion API
支付宝开放平台v3协议文档,支持最新版PHP8+
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-04