sf2h / sftp-bundle
This bundle provide quite simple functions for interact with SFTP servers
Installs: 71 765
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 3
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7
- ext-ssh2: *
- symfony/symfony: >=3.0
Requires (Dev)
- phpspec/phpspec: *
- phpunit/phpunit: ~5.0
This package is auto-updated.
Last update: 2021-10-10 11:41:51 UTC
README
SFTP Bundle
This bundle provides a simple interface for transfer files by SFTP protocol.
Installation
- Install the bundle using Composer:
composer require nw/sftp-bundle
- Enable bundle in
AppKernel.php
class AppKernel extends Kernel { public function registerBundles() { return array( // ... other bundles new NW\SFTPBundle\NWSFTPBundle() ); } }
Usage
- Connect to the SFTP server:
$sftp = $this->get('nw.sftp'); $sftp->connect($host, $port); $sftp->login($username, $password); // or $sftp->loginWithKey($host, $username, $pubkeyfile, $privkeyfile, $passphrase = null);
- Use SFTP client to transfer files:
$sftp->fetch('/path/to/remoteFile', '/path/to/localFile'); // or $sftp->send('/path/to/localFile', '/path/to/remoteFile');
- From CLI could be used one of the following commands:
app/console nw:sftp:fetch /path/to/remoteFile /path/to/localFile # - copy files from a remote server to the local machine # or app/console nw:sftp:send /path/to/localFile /path/to/remoteFile # - copy files from a local machine to the remote server