PHP code example of ariaieboy / caprover-sdk

1. Go to this page and download the library: Download ariaieboy/caprover-sdk 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/ */

    

ariaieboy / caprover-sdk example snippets


return [
    // Your Caprover main domain that point to the admin area
    'server'=>env('CAPROVER_SERVER'),
    // The password of your Caprover admin panel
    'password'=>env('CAPROVER_PASSWORD'),
    // Guzzle timeout in seconds
    'timeout'=>env('CAPROVER_TIMEOUT',60)
];

\Ariaieboy\CaproverLaravel\Facades\Caprover::method($args);

$caprover = new \Ariaieboy\Caprover\Caprover('caprover address','caprover password','timeout (default:60)')

$caprover->method($args);

$caprover = new \Ariaieboy\Caprover\Caprover('server','password');

$caprover->getCaptainInfo();

/**
* You can retrieve the auth token for the API calls
 * but it's not necessary to call other methods
 * The SDK will handle getting API Auth Token for you.
 */
$caprover->getAuthToken();

//Attach a new domain to an app
$caprover->attachNewCustomDomainToApp(appName: string,customDomain: string);

//Enable SSL for a custom domain on an app
$caprover->enableSslForCustomDomain(appName: string,customDomain: string);

//Remove a Custom domain from an app
$caprover->removeCustomDomain(appName: string,customDomain: string);

//Force Ssl on captain root domain
$caprover->forceSsl(isEnabled: bool);

//Change Captain root domain
$caprover->updateRootDomain(rootDomain: string);

//Enable root domain SSL
$caprover->enableRootSsl(emailAddress: string);

//Get All Apps
$caprover->getAllApps();
bash
php artisan vendor:publish --tag="caprover-config"