PHP code example of b1tc0re / deftcms-release

1. Go to this page and download the library: Download b1tc0re/deftcms-release 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/ */

    

b1tc0re / deftcms-release example snippets


$params = [
    'access_token' => 'you access token', // Ключ доступа
    'project_id'   => 1,                  // Идентификатор проэкта
    'storage_dir'  => 'storage',          // Корневая директория для работы с архивами
    'repository'   => 'release',          // Название архива сохраненого на FTP сервере
    'ftp'   => [    // Дополнительные параметры https://flysystem.thephpleague.com/docs/adapter/ftp/
        'host'      => 'ftp host',
        'username'  => 'ftp user name',
        'password'  => 'ftp password'
    ]
];

// Определение последней версии
$repository = new Repository($params['access_token']);
$archiveResult = $repository->download($params['project_id']);

// Загрузка релиза на FTP
$upload = new Uploader($params['ftp'], $params['storage_dir'], $params['repository']);
$upload->upload($archiveResult['content'], $archiveResult['version']);