swalker2/cpanel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

swalker2/cpanel

Composer 安装命令:

composer require swalker2/cpanel

包简介

the simplest PHP implementation of the cpanel versio 2 api for Laravel

README 文档

README

#swalker2 - Cpanel

The simplest PHP implementation of the cpanel version 2 api for Laravel

At the moment suporting only the Zone Edit and Email modules

You can write your own modules if you dig into the Guide to cPanel API 2

Install

Require this package with composer using the following command:

composer require swalker2/cpanel

After updating composer, add the service provider to the providers array in config/app.php

Swalker2\Cpanel\CpanelServiceProvider::class,

Also, publish the configuration file using the following command:

php artisan vendor:publish --tag=swalker2.cpanel

Finally, add the .env variables:

CPANEL_HOST=https://domain.com
CPANEL_PORT=2083
CPANEL_USERNAME=yourname
CPANEL_PASSWORD=yourpass

But how do I use it?

After completing the instalation steps, you simply make a cpanel instance, like so:

	$cpanel = app()->make(Cpanel::class);

And then you can call the module implementations

	dd(
		$cpanel->zoneEdit('mydomain.com')->fetch()
	);

Note that the Modules that you create can be instantiated individually:

	$mymodule = new MyCpanelModule();
	dd(
		$mymodule->doSomething()
	);

Writing a module

To write a module you need to extend the class Swalker2\CpanelFunction like so:

namespace App;


use Swalker2\Cpanel\CpanelBaseModule;

class CpanelModule extends CpanelBaseModule
{
    
    function __construct()
    {
        parent::__construct();
        $this->cpanel->mergeFields([
            'cpanel_jsonapi_module' => 'ModuleName', //reference this from the Guide to cPanel API 2
        ]);
    }
    
    public function someAction()
    {
        $this->cpanel->mergeFields([
            'cpanel_jsonapi_func' => 'some_action',
        ]);
                
        $response = $this->getApiData();
        
        //do something with the response
    }
}

Contributing

Feel free to send pull requests, not just bug reports.

"Bug reports" may also be sent in the form of a pull request containing a failing test.

However, if you file a bug report, your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix.

统计信息

  • 总下载量: 53
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固