kartulin / php-ftp-droid
Fast PHP-FTP-client
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
pkg:composer/kartulin/php-ftp-droid
Requires
- php: >=7.4
- ext-ftp: *
Requires (Dev)
This package is auto-updated.
Last update: 2025-11-20 16:16:45 UTC
README
Simple and comfortable library for work with FTP protocol. Supports:
- fluent interface
- callbacks
- ftp-ssl connect
- errors bag
- all available functions PHP-FTP
- easy in integration with any php-framework
- /* in next release*/
- PSR\LoggerInterface
- async operations
- retry operations
Installation
You can install the package via composer:
composer require kartulin/php-ftp-droid
Basic usage
use Kartulin\FtpDroid\FtpDroid;
// fast example
$ftp = FtpDroid::connect('127.0.0.1', $ssl = false, $port = 21, $timeout = 90)
->login('username', 'password')
->get($local_filename, $remote_filename, $mode = FTP_BINARY, $offset = 0)
->callback(function (FtpDroid $ftp){
if ($ftp->result){
// you logic here...
//see $ftp->errors...
}
})->chdir($directory)
->close();
All methods are good are documented. You can also read the documentaion on php.net
Call every method return the object of FtpDroid client:
var_dump($ftp);
Kartulin\FtpDroid\FtpDroid {#3 ▼
+hostname: "127.0.0.1"
+ssl: false
+port: 21
+timeout: 90
-handler: FTP\Connection {#2}
#logger: null
+result: true // the result of last method
+errors: array:1 [▼
1655710692 => "login"
// [timestamp_error => "the name of the method that received the error from the ftp server"]
]
You can use unlimited callbacks:
$ftp = FtpDroid::connect('127.0.0.1', $ssl = false, $port = 21, $timeout = 90)
->login('username', 'password')
->get()
->callback(function (FtpDroid $ftp){
// you logic 1 here...
})->chdir()
->callback(function (FtpDroid $ftp){
// you logic 2 here...
})
->method()
->callback();
Testing
cooming soon (PHPUnit and PhpStan)
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email stalkerxxl@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.