Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cannonb4ll/laravelftp
Laravel FTP client
https://github.com/cannonb4ll/laravelftp
composer ftp ftp-client laravel laravel-5-package
Last synced: about 1 month ago
JSON representation
Laravel FTP client
- Host: GitHub
- URL: https://github.com/cannonb4ll/laravelftp
- Owner: Cannonb4ll
- Created: 2016-01-16T20:29:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-07T09:08:13.000Z (over 6 years ago)
- Last Synced: 2024-11-18T15:49:13.586Z (about 1 month ago)
- Topics: composer, ftp, ftp-client, laravel, laravel-5-package
- Language: PHP
- Size: 32.2 KB
- Stars: 16
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LaravelFtp
Laravel FTP client (or any other project that utilises has composer)This project is just called LaravelFtp because I am holding this package to the conventions Laravel itself uses, they are great and easy.
It also utilises the collection package, files are returned as collection so you can use the Collection functions from Laravel.
# Usage
## Installation
Require this package with composer:
```
composer require dennissmink/laravel-ftp dev-master
```## Usage
Initiate a new FTP client like so:
```
$ftp = ftp($host, $user, $pass, $optionalport);
```Then, check if your connection was succesfull:
```
if(!$ftp){
// Connection failed
return 'Error while connecting to the FTP server';
}// Do your stuff
```**Methods**
*General file functions*
```
$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*
```
$ftp->createFile('filename.txt'); // Creates a file with the name 'filename.txt'
$ftp->createDirectory('directory name'); // Creates a directory 'directory name'
```*Delete files/directories*
```
$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
```## Links
Packagist: https://packagist.org/packages/dennissmink/laravel-ftp