PHP code example of achrafsoltani / sftp-service-provider
1. Go to this page and download the library: Download achrafsoltani/sftp-service-provider 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/ */
achrafsoltani / sftp-service-provider example snippets
sh
// Installing php-ssh2
$ sudo apt-get install libssh2-php
// checking if all is good
$ php -m |grep ssh2
{.php}
ilex\Application;
use AchrafSoltani\Provider\SftpServiceProvider;
use Silex\Provider\MonologServiceProvider;
$app = new Application();
// Monolog
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => __DIR__.'/logs/development.log',
));
// SFTP
$app->register(new SftpServiceProvider(), array(
'sftp.options' => array(
'hostname' => 'domain.tld', // or IP address
'username' => 'root',
'password' => 'your_ssh_password',
'port' => '22' // optional
)
));
// Usage
$app->run();