v2.x-dev
2.9999999.9999999.9999999-dev
The Requires
- php >=5.4.0
- illuminate/support ^5.0
by Dennis Smink
Wallogit.com
2017 © Pedro Peláez
Laravel FTP client (or any other project that utilises has composer), (*1)
This project is just called LaravelFtp because I am holding this package to the conventions Laravel itself uses, they are great and easy., (*2)
It also utilises the collection package, files are returned as collection so you can use the Collection functions from Laravel., (*3)
Require this package with composer:, (*4)
composer require dennissmink/laravel-ftp dev-master
Initiate a new FTP client like so:, (*5)
$ftp = ftp($host, $user, $pass, $optionalport);
Then, check if your connection was succesfull:, (*6)
if(!$ftp){
// Connection failed
return 'Error while connecting to the FTP server';
}
// Do your stuff
Methods, (*7)
General file functions, (*8)
$ftp->all(); // Returns all the files of the users root files (Collection)
$ftp->all('folder'); // Returns all the files of the directory folder (Collection)
$ftp->get('filename.txt') // Returns the content of the file, can also be: get('directory/filename.txt')
$ftp->save('filename.txt', 'content file'); // Save file 'filename.txt' with content 'content file', returns content if success
$ftp->rename('oldname.txt', 'newname.txt'); // Renames file or directory
Create files/directories, (*9)
$ftp->createFile('filename.txt'); // Creates a file with the name 'filename.txt'
$ftp->createDirectory('directory name'); // Creates a directory 'directory name'
Delete files/directories, (*10)
$ftp->deleteFile('filename.txt'); // Deletes a file with the name 'filename.txt'
$ftp->deleteDirectory('directory name'); // Removes a directory with the name 'directory name' (And its contents..)
$ftp->emptyDirectory('directory name'); // Emptys a directory but keeps the directory itself
Packagist: https://packagist.org/packages/dennissmink/laravel-ftp, (*11)