Skip to content

kisphp/php-sftp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PHP SFTP Client

example workflow

Installation

Add in composer:

{
    "require": {
        "kisphp/php-sftp-client": "~0.1"
    }
}

Usage

Create a config class that implements ConfigInterface

<?php

use Kisphp\ConfigInterface;

class Config implements ConfigInterface
{
    public function getHost()
    {
        return '10.10.0.61';
    }
    
    public function getPort()
    {
        return 22;
    }
    
    public function getUsername()
    {
        return 'vagrant';
    }
    
    public function getPassword()
    {
        return 'vagrant';
    }
}

Instantiate SftpConnect class and pass your Config object to it

$s = new SftpConnect(new Config());

Upload a file

$s->sendFile(__DIR__ . '/source.php', 'b.php'); // will return true for success and false for failure

Download a file

$s->receiveFile('a.php', 'c.php'); // will return true for success and false for failure

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages