A slim FTP wrapper.
Fund package maintenance!
sebastianfeldmann
Installs: 6 406
Dependents: 1
Suggesters: 1
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 1
Requires
- php: >=7.0.0
- ext-ftp: *
Requires (Dev)
- phpunit/phpunit: ^8.0 || ^9.0
Suggests
- ext-openssl: This should be loaded if connecting server via FTPS.
README
A tiny PHP FTP wrapper.
List all files
$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:password@example.com'); foreach ($ftp->ls() as $item) { echo $item->getFilename() . PHP_EOL; }
List only directories
$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:password@example.com'); foreach ($ftp->lsDirs() as $item) { echo $item->getFilename() . PHP_EOL; }
List without directories
$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:password@example.com'); foreach ($ftp->lsFiles() as $item) { echo $item->getFilename() . PHP_EOL; }
Upload a file
$ftp = new SebastianFeldmann\Ftp\Client('ftp://user:password@example.com'); $ftp->uploadFile($pathToLocalFile, 'foo/bar/baz', 'filname.zip');