PHP code example of masterfermin02 / cloud-ways-deploy
1. Go to this page and download the library: Download masterfermin02/cloud-ways-deploy 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/ */
masterfermin02 / cloud-ways-deploy example snippets
declare(strict_types=1);
Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();
use App\Input;
use CloudWays\Deploy\Client;
use CloudWays\Requester;
use CloudWays\Server;
$apiKey = $_ENV['API_KEY']; // API key clouds ways key
$API_URL = $_ENV['API_URL']; // your cloudways server api url
$email = $_ENV['DEPLOYMENT_EMAIL']; // your email to receive notifiy on deploy finish
$input = Input::create(array_merge($_GET, $_POST));
// git web hook example url http://yourserver/deployApplication.php?server_id=1234&app_id=1234&git_url=git_url&branch_name=master&deploy_path=path_to_your_app
$gitPullResponse = Client::create($email, $apiKey, Requester::create($API_URL))
->execute(Server::create(
$input->get('server_id'),
$input->get('git_url'),
$input->get('branch_name'),
$input->get('app_id')
));
echo (json_encode($gitPullResponse));