Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

sagebind/robo-ftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robo FTP Deploy Task

Version License Downloads

A simple task for the Robo task runner for deploying files to a remote server using FTP. Useful for shared hosting servers if you do not have SSH access, or for if you need better platform independence.

Installation

Add the package to your list of dependencies:

composer require --dev coderstephen/robo-ftp

This task uses dg/ftp-php for establishing FTP connections, which is a thin wrapper around the built-in FTP PHP extension. Most PHP installations are compiled with this extension, so this task should be able to be run just about anywhere with a PHP interpreter.

Usage

Just include the FtpDepoly trait in your RoboFile.php file and run an FTP deploy task using $this->taskFtpDeploy().

class RoboFile extends \Robo\Tasks
{
    use RoboFtp\FtpDeploy;

    function deploy()
    {
        $ftp = $this->taskFtpDeploy('host', 'user', 'password')
            ->dir('/')
            ->from('.')
            ->exclude('build')
            ->exclude('cache')
            ->skipSizeEqual()
            ->skipUnmodified()
            ->run();
    }
}

SSL Support

This task supports using FTP over SSL by default. You need the SSL extension for this to work, which isn't always available on Windows. If you want to disable SSL for your task, you can use the secure() method:

class RoboFile extends \Robo\Tasks
{
    use RoboFtp\FtpDeploy;

    function deploy()
    {
        $ftp = $this->taskFtpDeploy('host', 'user', 'password')
            ->dir('wwwroot')
            ->from('public')
            ->secure(false)
            ->run();
    }
}

Note that some Windows servers do not properly support FTP/S either and may error out when uploading files over SSL. Microsoft has made available a hotfix for this bug, but isn't distributed by default. More information here.