Giter Site home page Giter Site logo

laravelftp's Introduction

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

laravelftp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravelftp's Issues

how to copy file from ftp server

i want to copy excel sheet file from the ftp server.
when i tried this function
$ftp->get('filename.txt')
to get the content from the excel sheet on ftp server , the file is corrupted.
so i want to copy the hole file, not just the content

512 kb download limit

Is there a reason for hardcoding this limit value in the package?
if ($sizeFile > 512000) { // 512 000 KB return 'This file is too big to read, maximum filesize allowed to the browser: 512KB'; } else { if (@ftp_fget($this->connection, $tempHandle, $file, $this->mode, 0)) { rewind($tempHandle); $total = stream_get_contents($tempHandle); return $total; } else { return false; }

It would be great if this limit could be changed by the user from config or initiating connection method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.