Wallogit.com
2017 © Pedro Peláez
Huasituo Laravel Ftp
Run php artisan vendor:publish and modify the config file(config/ftp.php) with your ftp connections., (*1)
You can add dynamic FTP connections with following syntax, (*2)
Config::set('ftp.connections.key', array(
'host' => '',
'username' => '',
'password' => '',
'passive' => false,
));
You can access default FTP connection via the FTP::connection method:, (*3)
FTP::connection()->getDirListing(...);
When using multiple connections you can access each specific ftp connection by passing connection name:, (*4)
FTP::connection('foo')->getDirListing(...);
Sometimes you may need to reconnect to a given ftp:, (*5)
FTP::reconnect('foo');
If you need to disconnect from a given ftp use the disconnect method:, (*6)
FTP::disconnect('foo');
// With custom connection
$listing = FTP::connection('my-ftp-connection')->getDirListing();
// with default connection
$listing = FTP::connection()->getDirListing();
$status = FTP::connection()->makeDir('directory-name');
getDirListing($directory, $parameters ), (*7)
Returns a list of files in the given directory, (*8)
$directory: The directory to be listed. Default value: ..$parameters: Optional parameters to prefix with directory. For example: -la. Default: null.getDirListingDetailed($directory), (*9)
Returns a list of files in the given directory as an associative array with the following keys: rights, number, user, group, size, month, day and time, (*10)
$directory: The directory to be listed. Default value: ..makeDir($directory), (*11)
Creates the specified directory on the FTP server., (*12)
$directory: The name of the directory that will be created.changeDir($directory), (*13)
Changes the current directory on a FTP server., (*14)
$directory: The target directory.uploadFile($fileFrom, $fileTo, $mode), (*15)
Uploads a local file to the FTP server., (*16)
$fileFrom: The local file path.$fileTo: The remote file path.$mode: The transfer mode. Must be either FTP_ASCII or FTP_BINARY. Automatic mode resolution will be done if no mode is specified.downloadFile($fileFrom, $fileTo, $mode), (*17)
Downloads a file from the FTP server, (*18)
$fileFrom: The remote file path.$fileTo: The local file path (will be overwritten if the file already exists) or an open file pointer in which we store the data.$mode: The transfer mode. Must be either FTP_ASCII or FTP_BINARY. Automatic mode resolution will be done if no mode is specified.readFile($fileFrom), (*19)
Same as the downloadFile() method except it downloads the remote file to the PHP output buffer and returns it., (*20)
$fileFrom: The remote file path.moveUp(), (*21)
Changes to the parent directory., (*22)
permission($mode, $filename), (*23)
Set permissions on a file., (*24)
$mode: The new permissions, given as an octal value.$filename: The remote file.delete($path), (*25)
Deletes the file specified by path from the FTP server., (*26)
$path: The file to delete.currentDir(), (*27)
Returns the current directory name, (*28)
rename($oldName, $newName), (*29)
Renames a file or a directory on the FTP server., (*30)
$oldName: The old file/directory name.$newName: The new name.removeDir($directory, $recursive), (*31)
Removes a directory, (*32)
$directory: The directory to delete. This must be either an absolute or relative path to an empty directory.$recursive: Delete the folder recursively. Default value: false.truncateDir($directory), (*33)
Truncates a directory, (*34)
$directory: The directory to truncate. This must be either an absolute or relative path to a directory.size($remoteFile), (*35)
Returns the size of the given file in bytes.
Note: Not all servers support this feature., (*36)
$remoteFile: The remote file.time($remoteFile), (*37)
Returns the last modified time of the given file
Note: Not all servers support this feature., (*38)
$remoteFile: The remote file.