Download the PHP package dbeurive/ftp without Composer

On this page you can find all versions of the php package dbeurive/ftp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ftp

Introduction

This repository contains a wrapper around the (pretty good) PHP functionalities for FTP.

Synopsis

$options = array(Ftp::OPTION_PORT => $port, Ftp::OPTION_TIMEOUT => 60);

$ftp = new Ftp($host, $options);
$ftp->connect();
$ftp->login($user, $password);

$ftp->get($local_path, $remote_path); 
$ftp->put($local_path, $remote_path); 
$ftp->delete($remote_path);           
$ftp->mkdir($remote_path);
$entries = $ftp->ls($remote_path, true);

$status = $ftp->deleteIfExists($remote_path);
$status = $ftp->fileExists($remote_path);
$status = $ftp->directoryExists($remote_path);
$entry = $ftp->entryExists($remote_path);
$status = $ftp->mkdirRecursiveIfNotExist($remote_path);

$ftp->setEntryManagerClassName($your_own_class_name);

Installation

From the command line:

composer require dbeurive/ftp

Or, from within the file composer.json:

"require": {
    "dbeurive/ftp": "*"
}

Documentation

The code is heavily documented and there is a simple example for each method.

The last method (setEntryManager) needs to be described with more details.

The FTP command LIST returns a text that represents the list of entries (directories, files or links) in the remote directory. For example:

-rw-r--r--    1 0        0               1 Jan 15 14:08 file0.txt
-rw-r--r--    1 0        0               2 Jan 15 14:08 file1.txt
-rw-r--r--    1 0        0               3 Jan 15 14:08 file2.txt
-rw-r--r--    1 0        0               4 Jan 15 14:08 file3.txt
drwxr-xr-x    2 0        0            4096 Jan 15 14:08 r1
drwxr-xr-x    2 0        0            4096 Jan 15 14:08 r2
drwxr-xr-x    2 0        0            4096 Jan 15 14:08 r3
drwxr-xr-x    2 0        0            4096 Jan 15 14:08 r4

Please note that:

However, this text must be parsed in order to extract the list of entries, along with their properties (permissions, owners, groups...).

It is not possible to handle all possible text organisations (for all OS and maybe, all FTP servers) and all possible properties.

Thus, the FTP wrapper lets the user the possibility to declare its own class that handles the parsing of the text and manages the properties. The default class used is EntryManagerUnix.

However, you can write and declare your own class to handle another use case. Your class must extends the abstract class AbstractEntryManager.

You must set your entry manager BEFORE issuing any command that deals with entries (LIST...). You should set it right after you instantiate the Ftp object.

See this example.

Unit tests

In order to run the unit tests, you need the following elements:

SSH is used to execute shell commands on the host that runs the FTP server. These commands will prepare the environment for the tests.

Preparation

Edit tests/setenv.sh

This script defines parameters used during the unit tests. These parameters are:

The parameters below used to (unit) test valid test cases

The parameters used to (unit) test invalid test cases

The parameters used to set up the environment on the host that run the FTP server

Example:

export FTP_REMOTE_HOST_OK='10.11.12.13'
export FTP_USER_OK='good_ftp_user_name'
export FTP_PASSWORD_OK='goot_ftp_password'
export FTP_PORT_OK=21    
export FTP_REMOTE_HOST_KO='yahoo.com'
export FTP_USER_KO='invalid_user_name'
export FTP_PASSWORD_KO='invalid password'
export FTP_PORT_KO=10021
export ROOT_ON_REMOTE='/files';
export BAD_DIR_ON_REMOTE='/tmp';
export SSH_ARG='[email protected]'

Edit tests/clear_on_remote.sh

The script tests/clear_on_remote.sh will be executed on the host that runs the FTP server. It will prepare the environment for the unit tests.

Set the correct value for FTP_REMOTE_DIR.

FTP_REMOTE_DIR: absolute system path, on the host that runs the server, used to get or put files through FTP.

Example:

FTP_REMOTE_DIR=/home/ftpuser/ftp/files

Run the unit tests

Run the commands below:

. ./tests/setenv.sh
./vendor/bin/phpunit

All versions of ftp with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dbeurive/ftp contains the following files

Loading the files please wait ....