PHP code example of cullylarson / wp-deploy-folder-sync

1. Go to this page and download the library: Download cullylarson/wp-deploy-folder-sync 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/ */

    

cullylarson / wp-deploy-folder-sync example snippets


curl -s http://getcomposer.org/installer | php
php composer.phar 



class MyWordpressDeployer {
    public function deploy() {
        // ...
        
        $folderSync = new Wordpress\Deploy\FolderSync(
            "path/to/local/uploads/",
            "[email protected]:path/to/remote/uploads/",
            ['delete' => true, 'exclude' => ['.gitkeep']]);
            
        $folderSync->sync();
        
        // ...
    }
}



class MyWordpressDeployer {
    public function deploy() {
        // ...
        
        $statusCallback = function(Wordpress\Deploy\FolderSync\Status $status) {
            echo $status->Timestamp . " -- ";
            
            if( $status->isError() ) echo "ERROR: ";
            if( $status->isWarning() ) echo "WARNING: ";
            if( $status->isRawOutput() ) echo "================\n";
            
            echo $status->Message;
            
            if( $status->isRawOutput() ) echo "================\n";
        }
        
        $folderSync = new Wordpress\Deploy\FolderSync(
            "path/to/local/uploads/",
            "[email protected]:path/to/remote/uploads/");
            
        $folderSync->sync($statusCallback);
        
        // ...
    }
}