-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusted namings, documentation and tests (#3)
* Adjusted namings, documentation and tests * Adjusted dependencies and travis ci * Adjusted travis ci * Updated README
- Loading branch information
Showing
15 changed files
with
172 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ vendor/* | |
composer.lock | ||
phpunit.xml | ||
Tests/cache/* | ||
var/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
language: php | ||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
|
||
matrix: | ||
include: | ||
- php: 5.3 | ||
dist: precise | ||
php: | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
|
||
before_script: | ||
- sudo apt-get update | ||
- sudo apt-get install libssh2-1-dev libssh2-php | ||
- sudo apt-get install libssh2-1-dev php-ssh2 | ||
- echo '' | pecl install -f ssh2 | ||
- echo "extension=ssh2.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` | ||
- php -m | grep ssh2 | ||
- "travis_wait 30 sleep 1800 &" | ||
- composer self-update | ||
- composer install | ||
|
||
script: | ||
- vendor/bin/phpunit | ||
- ./vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
...encyInjection/SF2HelpersSFTPExtension.php → DependencyInjection/NWSFTPExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace NW\SFTPBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* Class NWSFTPBundle | ||
* @package NW\SFTPBundle | ||
* @author Novikov Viktor | ||
*/ | ||
class NWSFTPBundle extends Bundle | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,55 @@ | ||
[](https://insight.sensiolabs.com/projects/e0b26b60-76f3-40a4-9416-9b6c65fb93a2) [](https://scrutinizer-ci.com/g/NovikovViktor/SFTPBundle/?branch=develop) [](https://travis-ci.org/NovikovViktor/SFTPBundle) [](https://codeclimate.com/github/NovikovViktor/SFTPBundle/maintainability) | ||
[](https://insight.sensiolabs.com/projects/e0b26b60-76f3-40a4-9416-9b6c65fb93a2) [](https://scrutinizer-ci.com/g/NovikovViktor/SFTPBundle/?branch=develop) [](https://travis-ci.org/nowiko/SFTPBundle) [](https://codeclimate.com/github/NovikovViktor/SFTPBundle/maintainability) | ||
|
||
Symfony2 Helpers - SFTP bundle | ||
SFTP Bundle | ||
===================== | ||
|
||
This bundle provide simple interface for transfer files by [SFTP](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol) protocol. | ||
This bundle provides a simple interface for transfer files by SFTP protocol. | ||
|
||
Installation | ||
============== | ||
|
||
1) Install libssh2-php library: | ||
1) Install the bundle using Composer: | ||
```bash | ||
composer require nw/sftp-bundle | ||
``` | ||
|
||
2) Enable bundle in `AppKernel.php` | ||
|
||
```php | ||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
return array( | ||
// ... other bundles | ||
new NW\SFTPBundle\NWSFTPBundle() | ||
); | ||
} | ||
} | ||
``` | ||
|
||
```bash | ||
// Ubuntu | ||
sudo apt-get update | ||
sudo apt-get install libssh2-1-dev libssh2-php | ||
|
||
//MacOS | ||
sudo port install libssh2 | ||
sudo pecl install channel://pecl.php.net/ssh2-0.12 | ||
// when you will be asked about lib prefix put /opt/local , so terminal will look like | ||
libssh2 prefix? [autodetect] : /opt/local | ||
|
||
// enable extension in php.ini | ||
extension = ssh2.so | ||
|
||
//Restart server | ||
sudo service apache2 restart | ||
``` | ||
|
||
2) Install bundle using Composer: | ||
|
||
```bash | ||
composer require sf2h/sftp-bundle | ||
``` | ||
|
||
3) Enable bundle in `AppKernel.php` | ||
|
||
```php | ||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = array( | ||
// ... some other bundles | ||
new SF2Helpers\SFTPBundle\SF2HelpersSFTPBundle() | ||
} | ||
// ... other code | ||
} | ||
``` | ||
Usage | ||
======= | ||
|
||
1) Connect to server via `sf2h.sftp` service: | ||
```php | ||
$sftp = $this->get('sf2h.sftp'); | ||
$sftp->connect($host, $port); | ||
$sftp->login($username, $password); | ||
// or | ||
$sftp->loginWithKey($host, $username, $pubkeyfile, $privkeyfile, $passphrase = null); | ||
``` | ||
2) Use sftp service to transfer files over SFTP: | ||
```php | ||
$sftp->fetchFrom('/path/to/remoteFile', '/path/to/localFile'); | ||
// or | ||
$sftp->sendTo('/path/to/localFile', '/path/to/remoteFile'); | ||
``` | ||
1) Connect to the SFTP server: | ||
```php | ||
$sftp = $this->get('nw.sftp'); | ||
$sftp->connect($host, $port); | ||
$sftp->login($username, $password); | ||
// or | ||
$sftp->loginWithKey($host, $username, $pubkeyfile, $privkeyfile, $passphrase = null); | ||
``` | ||
|
||
2) Use SFTP client to transfer files: | ||
```php | ||
$sftp->fetch('/path/to/remoteFile', '/path/to/localFile'); | ||
// or | ||
$sftp->send('/path/to/localFile', '/path/to/remoteFile'); | ||
``` | ||
|
||
3) From CLI could be used one of the following commands: | ||
- `php app(bin)/console sf2h:sftp:fetchFrom /path/to/remoteFile /path/to/localFile` - to copy files from remote server to local machine | ||
- `php app(bin)/console sf2h:sftp:sendTo /path/to/localFile /path/to/remoteFile` - to copy files from local server to remote machine | ||
```bash | ||
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.