2017 © Pedro Peláez
 

library cpanel

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

image

swalker2/cpanel

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

  • Sunday, May 14, 2017
  • by swalker
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 27 % Grown

The README.md

swalker2 - Cpanel

The simplest PHP implementation of the cpanel version 2 api for Laravel, (*1)

At the moment suporting only the Zone Edit and Email modules, (*2)

You can write your own modules if you dig into the Guide to cPanel API 2, (*3)

### Install, (*4)

Require this package with composer using the following command: bash composer require swalker2/cpanel, (*5)

After updating composer, add the service provider to the providers array in config/app.php php Swalker2\Cpanel\CpanelServiceProvider::class,, (*6)

Also, publish the configuration file using the following command: bash php artisan vendor:publish --tag=swalker2.cpanel, (*7)

Finally, add the .env variables: CPANEL_HOST=https://domain.com CPANEL_PORT=2083 CPANEL_USERNAME=yourname CPANEL_PASSWORD=yourpass, (*8)

But how do I use it?

After completing the instalation steps, you simply make a cpanel instance, like so:, (*9)

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

And then you can call the module implementations, (*10)

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

Note that the Modules that you create can be instantiated individually:, (*11)

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

Writing a module

To write a module you need to extend the class Swalker2\CpanelFunction like so:, (*12)

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., (*13)

"Bug reports" may also be sent in the form of a pull request containing a failing test., (*14)

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., (*15)

The Versions

14/05 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by swalker2

laravel cpanel

14/05 2017

dev-analysis-XVYE6Z

dev-analysis-XVYE6Z

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by swalker2

laravel cpanel

03/02 2017

v1.1

1.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by swalker2

laravel cpanel