An open API service indexing awesome lists of open source software.

https://github.com/masterfermin02/cloudways-deployment

A deployment tool written in PHP to deploy apps to cloudways.
https://github.com/masterfermin02/cloudways-deployment

Last synced: about 1 year ago
JSON representation

A deployment tool written in PHP to deploy apps to cloudways.

Awesome Lists containing this project

README

          

Social Card of cloudways deployment tool

# cloudways-deployment

[![GitHub forks](https://img.shields.io/github/forks/masterfermin02/cloudways-deployment)](https://img.shields.io/github/issues/masterfermin02/cloudways-deployment)
[![GitHub starts](https://img.shields.io/github/stars/masterfermin02/cloudways-deployment)](https://img.shields.io/github/stars/masterfermin02/cloudways-deployment)
[![license](https://img.shields.io/github/license/masterfermin02/cloudways-deployment)](LICENSE.md)

A deployment tool written in PHP to deploy apps to cloudways.

## Installation and usage

This package requires PHP 8 or higher.

- Install by composer
```bash
composer require masterfermin02/cloud-ways-deploy
```
# Use
- Config your git webhook [doc](https://docs.github.com/en/developers/webhooks-and-events/creating-webhooks)
- Deploy example script:
```php
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));
```

## Testing

Run the tests with:

``` bash
composer test
```

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Credits

- [Fermin Perdomo](https://github.com/masterfermin02)
- [All Contributors](../../contributors)