PHP code example of luisfertechxonn / yii2-gsftp

1. Go to this page and download the library: Download luisfertechxonn/yii2-gsftp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

luisfertechxonn / yii2-gsftp example snippets


return [
	// [...]
	'components'=>[
		// [...]
		'ftp' => [
			'class' => '\gftp\FtpComponent',
			'connectionString' => 'sftp://user:pass@host:22',
			'driverOptions' => [ 'timeout' => 120 ]
		]
	],
	// [...]
];

return [
	// [...]
	'components'=>[
		// [...]
		'ftp' => [
			'class' => '\gftp\FtpComponent',
			'driverOptions' => [
				'class' => \gftp\FtpProtocol::valueOf('sftp')->driver,
				'user' => '[email protected]',
				'pass' => 'PassW0rd',
				'host' => 'ssh.somewhere.otrb',
				'port' => 22,
				'timeout' => 120
			]
		]
	],
	// [...]
];

use gftp\drivers\SftpDriver;

    /**
     * Function that will create the object with users and passwords
	 * Do not forget to control the exceptions and errors!!!!!
     */
    public function FTPClient(p)
    {
        $sftp = new SftpDriver();
        $sftp->setHost("host.host.es");
        $sftp->setUser("LuisferParra");
        $sftp->setPass("TheAmazingPassword123456");
        $sftp->connect();
        $sftp->login();
    }


php composer.phar