burakboz/cyberlink
Composer 安装命令:
composer require burakboz/cyberlink
包简介
Fills the missing CyberPanel API. Warning: It's not an API or API service. It uses ssh and sftp protocols to get job done and requires root access to server.
README 文档
README
A php library to utilize CyberPanel without API.
Take a look to CyberPanel api documentation, yes almost nothing.
Currently CyberPanel doesn't have API functions fully described and implemented.
So I wrote this library.
##Composer Install
composer require burakboz/cyberlink:dev-master
##Example usage
// If you need public key auth on ssh connection provide private key string to $key parameter otherwise it should be null.
// $enableSecureFTP parameter should be true for using setCustomSSL method.
// If you don't need this don't set it true.
$ip = "127.0.0.1";
$user = "root"; // use only root user
$password = "TopSecretPassword"; // root password
$port = 22; // ssh port
$timeout = 20; // connection timeout
$enableSecureFTP = false; // set it true if you use $cyberlink->setCustomSSL() method.
$cyberlink = new \BurakBoz\CyberLink($ip, $user, $password, $key = null, $port = 22, $timeout = 10, $enableSecureFTP = false);
$phpVersion = "7.3";
$owner = "admin";
$package = "Default";
try
{
if($cyberlink->createWebsite("merhaba.com", "admin@siteowner.com", $package, $owner, $phpVersion))
{
echo "Host created.";
}
else
{
echo "Error: " . $cyberlink->getLastMessage();
}
}
catch (Exception $e)
{
echo "Error: " . $e->getMessage();
}
What is the magic of this library?
Website Functions
createWebsite
/**
* @param $domainName
* @param $email
* @param string $package
* @param string $owner
* @param string $phpVersion
* @return bool
* @throws Exception
*/
$cyberlink->createWebsite($domainName, $email, $package = self::package, $owner = self::owner, $phpVersion = self::phpVersion);
deleteWebsite
/**
* @param $domainName
* @return bool
* @throws Exception
*/
$cyberlink->deleteWebsite($domainName);
createChild
/**
* @param $masterDomain
* @param $childDomain
* @param string $owner
* @param string $phpVersion
* @return bool
* @throws Exception
*/
$cyberlink->createChild($masterDomain, $childDomain, $owner = self::owner, $phpVersion = self::phpVersion);
deleteChild
/**
* @param $childDomain
* @return bool
* @throws Exception
*/
$cyberlink->deleteChild($childDomain);
listWebsites
/**
* @return mixed
*/
$cyberlink->listWebsites();
changePHP
/**
* @param $domainName
* @param string $phpVersion
* @return bool
* @throws Exception
*/
$cyberlink->changePHP($domainName, $phpVersion = self::phpVersion);
changePackage
/**
* @param $domainName
* @param string $packageName
* @return bool
* @throws Exception
*/
$cyberlink->changePackage($domainName, $packageName = self::package);
DNS Functions
Not Implemented yet.
Backup Functions
createBackup
/**
* @param $domainName
* @return bool
* @throws Exception
*/
$cyberlink->createBackup($domainName);
restoreBackup
/**
* @param $domainName
* @param $fileName
* @return bool
* @throws Exception
*/
$cyberlink->restoreBackup($domainName, $fileName);
Package Functions
createPackage
/**
* @param $packageName
* @param int $diskSpace
* @param int $bandwidth
* @param int $emailAccounts
* @param int $dataBases
* @param int $ftpAccounts
* @param int $allowedDomains
* @param string $owner
* @return bool
* @throws Exception
*/
$cyberlink->createPackage($packageName, $diskSpace = 1000, $bandwidth = 10000, $emailAccounts = 100, $dataBases = 100, $ftpAccounts = 100, $allowedDomains = 100, $owner = self::owner);
deletePackage
/**
* @param $packageName
* @return bool
* @throws Exception
*/
$cyberlink->deletePackage($packageName);
listPackages
/**
* @return mixed
*/
$cyberlink->listPackages();
Database Functions
createDatabase
/**
* @param $databaseWebsite
* @param $dbName
* @param $dbUsername
* @param $dbPassword
* @return bool
* @throws Exception
*/
$cyberlink->createDatabase($databaseWebsite, $dbName, $dbUsername, $dbPassword);
deleteDatabase
/**
* @param $dbName
* @return bool
* @throws Exception
*/
$cyberlink->deleteDatabase($dbName);
listDatabases
/**
* @param $databaseWebsite
* @return mixed
*/
$cyberlink->listDatabases($databaseWebsite);
Email Functions
Not Implemented yet.
FTP Functions
createFTPAccount
/**
* @param $domainName
* @param $userName
* @param $password
* @param string $owner
* @return bool
* @throws Exception
*/
$cyberlink->createFTPAccount($domainName, $userName, $password, $owner = self::owner);
deleteFTPAccount
/**
* @param $userName
* @return bool
* @throws Exception
*/
$cyberlink->deleteFTPAccount($userName);
changeFTPPassword
/**
* @param $userName
* @param $password
* @return bool
* @throws Exception
*/
$cyberlink->changeFTPPassword($userName, $password);
listFTP
/**
* @param $domainName
* @return mixed
*/
$cyberlink->listFTP($domainName);
SSL Functions
issueSSL
/**
* @param $domainName
* @return bool
* @throws Exception
*/
$cyberlink->issueSSL($domainName);
hostNameSSL
/**
* @param $domainName
* @return bool
* @throws Exception
*/
$cyberlink->hostNameSSL($domainName);
mailServerSSL
/**
* @param $domainName
* @return bool
* @throws Exception
*/
$cyberlink->mailServerSSL($domainName);
Extra Functions
Set Custom SSL
/**
* Warning! This method shouldn't be trusted. In future versions of CyberPanel (Currently 1.9) and LiteSpeed may cause system failure. Use at your own risk.
* @param $domain
* @param $publicKey
* @param $privateKey
* @return bool
* @throws Exception
*/
$cyberlink->setCustomSSL($domain, $publicKey, $privateKey);
Reset CyberPanel Admin Password
/**
* @param $password
* @return string
*/
$cyberlink->resetAdminPassword($password);
Upgrade CyberPanel
/**
* @return string
*/
$cyberlink->upgradeCyberPanel();
Restart LiteSpeed
/**
* @return string
*/
$cyberlink->restartLiteSpeed();
Reboot Server
/**
* @return string
*/
$cyberlink->rebootServer();
Server Uptime
/**
* @return string
*/
$cyberlink->uptime();
burakboz/cyberlink 适用场景与选型建议
burakboz/cyberlink 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 50 次下载、GitHub Stars 达 9, 最近一次更新时间为 2019 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 burakboz/cyberlink 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 burakboz/cyberlink 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-22