Sync

Sync use scp command for deploy file(s)/folder(s) to remote server.

Installation

composer require mediashare/kernel
1

Code

<?php
// ./deploy.php
require 'vendor/autoload.php';
use Mediashare\Kernel\Kernel;
// Kernel
$kernel = new Kernel();
$kernel->run();

// Deploy
$sync = $kernel->get('Sync');
$sync->username = "username";
$sync->host = "blog.com";
$sync->directory = "blog";
$sync->destination = "/var/www";
$sync->run();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

This script execute SCP command line like this:

scp -r blog username@blog.com:/var/www
1
Last Updated: 1/13/2020, 8:18:06 PM