PHP code example of webreinvent / laravel-cpanel

1. Go to this page and download the library: Download webreinvent/laravel-cpanel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webreinvent / laravel-cpanel example snippets

  
/*  
 * Package Service Providers...  
 */ 
 'providers' => [  
        //...  
        WebReinvent\CPanel\CPanelServiceProvider::class,   
        //...  
    ],

$cpanel = new CPanel($cpanel_domain=null, $cpanel_api_token=null, $cpanel_username=null, $protocol='https', $port=2083);

use WebReinvent\CPanel\CPanel;

$cpanel = new CPanel();
$response = $cpanel->createDatabase('cpanelusername_databasename');

$cpanel = new CPanel();  
$response = $cpanel->deleteDatabase('cpanelusername_databasename');

$cpanel = new CPanel();  
$response = $cpanel->listDatabases();

$cpanel = new CPanel();  
$response = $cpanel->createDatabaseUser($username, $password);

$cpanel = new CPanel();  
$response = $cpanel->deleteDatabaseUser($username);

$cpanel = new CPanel();  
$response = $cpanel->setAllPrivilegesOnDatabase($database_user, $database_name);

$cpanel = new CPanel();  
$response = $cpanel->callUAPI($Module, $function, $parameters_array);

$cpanel = new CPanel();  
$Module = 'Ftp';
$function = 'add_ftp';
$parameters_array = [
'user'=>'ftp_username',
'pass'=>'ftp_password', //make sure you use strong password
'quota'=>'42',
];
$response = $cpanel->callUAPI($Module, $function, $parameters_array);

php artisan vendor:publish --provider="WebReinvent\CPanel\CPanelServiceProvider" --tag=config