1. Go to this page and download the library: Download altayalp/ftp-client 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/ */
altayalp / ftp-client example snippets
// connect to ftp server
use altayalp\FtpClient\Servers\FtpServer;
$server = new FtpServer('ftp.example.com');
$server->login('user', 'password');
// or connect to ssh server
use altayalp\FtpClient\Servers\SftpServer;
$server = new SftpServer('ssh.example.com');
$server->login('user', 'password');
// connect to ftp server
use altayalp\FtpClient\Servers\FtpServer;
$server = new FtpServer('ftp.example.com', 21, 90);
$server->login('user', 'password');
// or connect to ssh server
use altayalp\FtpClient\Servers\SftpServer;
$server = new SftpServer('ssh.example.com', 22);
$server->login('user', 'password');
$server->turnPassive();
use altayalp\FtpClient\FileFactory;
$file = FileFactory::build($server);
$list = $file->ls('public_html');
print_r($list);
Helper::formatByte($file->getSize('public_html/dashboard.zip'));
// Will output: 32.47 Mb
Helper::formatDate($file->getLastMod('public_html/dashboard.zip'));
// Will output: 14.06.2016 23:31
// or
Helper::formatDate($file->getLastMod('public_html/dashboard'), 'd.m.Y');
// Will output: 14.06.2016
Helper::getFileExtension($fileName);
// Will output: html
$file->download('public_html/demo.html', Helper::newName('demo.html'));
// if exist local file, rename file
// demo.html renamed to demo_dae4c9057b2ea5c3c9e96e8352ac28f0c7d87f7d.html
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.