2017 © Pedro PelĂĄez
 

yii2-extension yii2-gftp

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

image

hguenot/yii2-gftp

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  • Monday, February 19, 2018
  • by hguenot
  • Repository
  • 4 Watchers
  • 15 Stars
  • 19,384 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 9 Versions
  • 11 % Grown

The README.md

Latest Stable Version Total Downloads License, (*1)

GFtp

GFtp is a FTP extension for YII 2 Framework., (*2)

It contains 2 main component :, (*3)

  • \gftp\FtpComponent : A Yii component used to manage FTP connection and navigation (encapsulates PHP ftp method).
  • \gftp\FtpWidget : A widget which can be used to display FTP folder content and allow FTP server browsing.

It supports FTP protocol and FTP over SSL protocol. SFTP support is provider by Yii2-gsftp extension., (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

php composer.phar require --prefer-dist hguenot/yii2-gftp "*"

or add, (*7)

"hguenot/yii2-gftp": "*"

to the require section of your composer.json file., (*8)

Usage

Here is a basic usage of GFtp extension., (*9)

  • Create an FTP application component (in your Web config file)
return [
    // [...]
    'components'=>[
        // [...]
        'ftp' => [
            'connectionString' => 'ftp://user:pass@host:21',
            'driverOptions' =>  [
                'timeout' => 120,
                'passive' => false
            ]
        ]
    ],
    // [...]
];
  • You can user either a connection string where protocol could be ftp or ftps or directly set protocol, user, pass, host and port properties :
return [
    // [...]
    'components'=>[
        // [...]
        'ftp' => [
            'class' => '\gftp\FtpComponent',
            'driverOptions' =>  [
                'class' => '\gftp\drivers\SftpProtocol',
                'user' => 'me@somewhere.otrb',
                'pass' => 'PassW0rd',
                'host' => 'ftp.somewhere.otrb',
                'port' => 2121,
                'timeout' => 120,
                'passive' => false
            ]
        ]
    ],
    // [...]
];
  • Use component
$files = $gftp->ls();
$gftp->chdir('images');

More complete example :, (*10)

public function actionExample() { 
    $remote_file = '/data/users.txt'; 
    $local_file = '/tmp/users.load'; 
    $mode = 'FTP_ASCII'; 
    $asynchronous = false; 
    $file = Yii::$app->ftp->get($remote_file, $local_file, $mode, $asynchronous); 
    // [...]
} 
  • Display ftp content in a Widget :
use gftp\FtpWidget;
echo FtpWidget::widget();
  • If no FTP(S) connection is passed to the widget, it needs an application component named 'ftp'. But you can pass an FtpComponent directly :
use \gftp\FtpWidget;
echo FtpWidget::widget([
    'ftp' => \Yii::$app->get('otrb')
]);

or, (*11)

use \gftp\FtpWidget;
use \gftp\FtpComponent;

echo FtpWidget::widget([
    'ftp' => new FtpComponent([
            'driverOptions' =>  [
                'class' => '\gftp\drivers\SftpProtocol',
                'user' => 'me@somewhere.otrb',
                'pass' => 'PassW0rd',
                'host' => 'ftp.somewhere.otrb',
                'port' => 2121,
                'timeout' => 120,
                'passive' => false
            ]
    ]);
]);

The Versions

19/02 2018

dev-master

9999999-dev

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

19/02 2018

2.2.0

2.2.0.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

09/05 2016

2.1.3

2.1.3.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

11/12 2015

V2.1.2

2.1.2.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

02/11 2015

V2.1.1

2.1.1.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

03/08 2015

2.1

2.1.0.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

15/07 2015

2.0.1

2.0.1.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

19/06 2015

2.0

2.0.0.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2 gftp

14/06 2015

1.0

1.0.0.0

Ftp is a FTP extension for [YII 2 Framework](http://www.yiiframework.com).

  Sources   Download

GPL-3.0+

The Requires

 

by Hervé Guenot

extension yii2