PHP code example of ente / portainer-php-api

1. Go to this page and download the library: Download ente/portainer-php-api 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/ */

    

ente / portainer-php-api example snippets


use Portainer\Portainer;
$portainer = new Portainer(__DIR__, ".env", "username", "password", "https://yourhost:9443");

echo var_dump($portainer->customTemplates()->list()); // array containing custom templates

bash

composer