Laravel FTP client

Overview

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

You might also like...
php 8 client for the lemon.markets api

lemon.markets php client This repository contains a php 8+ compatible client for the https://lemon.markets API. The documentation of the API can be fo

PHP client for Microsoft Azure Face API.

Microsoft Azure Face API PHP client A PHP library that utilizes Azure Face REST API. Requirements PHP = 7.4 Installation composer require darmen/php-

Google PHP API Client Services

Google PHP API Client Services

AltiriaSmsPhpClient, the official PHP client of Altiria
AltiriaSmsPhpClient, the official PHP client of Altiria

Altiria, cliente SMS PHP Altiria SMS PHP es un cliente que simplifica al máximo la integración de nuestro API para PHP. Por el momento, esta librería

A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP
A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP

A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP. Including adding reviews to a store's products. It is used to import and export reviews through the API. This is the official package built and developed by A2Reviews, Inc.

PHP Client for the GoFlink API

GoFlink PHP API Client This project is an unofficial library to communicate with the GoFlink API from your PHP project. Documentation about the API is

An independent client for Kibilog.com, running on native code.

The library is a client for working with Kibilog.com The client works without cUrl. To work, it is necessary that in php.ini there is a setting allow_

A PHP client for the official Kizeo Forms API V3+. 📌

Kizeo Forms API V3+ - PHP This is a Swagger generated doc for Kizeo REST API 3. You can find additionnal documentation here : Online documentation. Th

json-rpc client base on http

laravel JSON-RPC客户端(Http协议) 本项目是基于JSON-RPC的服务端端实现的rpc客户端 server端见:https://sajya.github.io/ 初始化 发布 php artisan vendor:publish --provider="Ze\JsonRpcCli

Comments
  • 512 kb download limit

    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.

    opened by danielispas 5
  • how to copy file from ftp server

    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

    opened by ahmed-bermawy 3
  • Setting file name equal to class name

    Setting file name equal to class name

    The file name should be equal to class name, otherwise Linux and similar system will fail to load this class.

    Linux filesystem is case sensitive so using:

    use LaravelFtp\FTP;

    will not work if file is named Ftp.php

    Please see: http://stackoverflow.com/a/15494814/2030783

    opened by Machecek 1
Owner
Dennis Smink
Laravel enthusiast. Founder of @ploi-deploy, @documentator-io and @LaraBug
Dennis Smink
PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

PHP JSON-RPC 2.0 Server/Client Implementation with Automatic Client Class Generation via SMD

Sergey Bykov 63 Feb 14, 2022
OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Mounir R'Quiba 6 Jun 14, 2023
Laravel ClickHouse adds CH client integration, generation & execution of ClickHouse database migrations to the Laravel application.

Laravel ClickHouse Introduction Laravel ClickHouse database integration. This package includes generation and execution of the ClickHouse database mig

cybercog 11 Dec 20, 2022
Spikkl API client for Laravel

Spikkl for Laravel Spikkl-php-laravel-client incorporates the Spikkl API into your Laravel or Lumen project. Requirements Get yourself a free Spikkl a

Spikkl 0 Jul 17, 2022
A simple PHP GitHub API client, Object Oriented, tested and documented.

PHP GitHub API A simple Object Oriented wrapper for GitHub API, written with PHP. Uses GitHub API v3 & supports GitHub API v4. The object API (v3) is

KNP Labs 2k Jan 7, 2023
A simple Object Oriented PHP Client for Termii SMS API

Termii Client A simple Object Oriented PHP Client for Termii SMS API. Uses Termii API. Requirements PHP >= 7.2 Guzzlehttp ~6|~7 Installation Via Compo

Ilesanmi Olawale Adedotun 5 Feb 24, 2022
oursms.app client library that allows you to send SMS

Oursms laravel client https://oursms.app client library that allows you to send SMS Installation Install oursms client with composer composer requir

Khalid Mohammad 11 Aug 27, 2022
Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

Xendit 96 Jan 6, 2023
PHP client for Kafka

A library to allow people to communicate to Kafka using plain PHP, compatible with Kafka v0.11+ (due to the way the protocol works).

Luís Cobucci 52 Dec 23, 2022
DigitalOcean API v2 client for Symfony and API Platform

DigitalOcean Bundle for Symfony and API Platform DunglasDigitalOceanBundle allows using the DigitalOcean API from your Symfony and API Platform projec

Kévin Dunglas 25 Jul 27, 2022