Download the PHP package cxxi/ftp-client without Composer

On this page you can find all versions of the php package cxxi/ftp-client. 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-client

cxxi/ftp-client

PHP Version CI Tests codecov PHPStan Level Packagist Downloads

Pure PHP FTP / FTPS / SFTP client (framework agnostic).

Simple, expressive API:

A clean, testable and production-ready transport layer designed for:

Supports:


Table of Contents


Why this library?

PHP already provides ext-ftp and ext-ssh2. So why wrap them?

Because raw extensions:

This library adds:

Unified API

Same interface for FTP, FTPS and SFTP.

Switch protocol by changing the URL scheme.


Built-in Retry Strategy

Designed for unstable networks and production systems.


Secure SFTP Support

No silent trust of unknown hosts.


Clean Architecture


Framework Agnostic

Works in:

No framework dependency.


Production Ready

This library is:

It is built to be used in critical environments where network instability and safe retries matter.


Installation


Requirements

Optional extensions:

Note: FTPS requires ext-ftp with SSL support (ftp_ssl_connect() available).


Quick Start


URL Format

Notes:


Using Connection Options

You can pass a ConnectionOptions instance:

Array format (canonical structure)

You can also build options from an array. The canonical structure groups transport-layer options under dedicated keys, so protocol-specific settings stay isolated and easy to extend.

Protocol-specific keys are ignored when not applicable (e.g. passive is ignored for SFTP).


Supported Options

timeout

Type: int|null Applies to: FTP / FTPS / SFTP


passive (FTP / FTPS only)

Type: auto | true | false

Ignored for SFTP.


SFTP Host Key Verification

SFTP supports strict host key verification using MD5 or SHA1 fingerprints (as supported by ext-ssh2).

If strictHostKeyChecking is enabled and fingerprint does not match, connection will fail.


SFTP Fingerprint Limitations (ext-ssh2)

When using the ext-ssh2 extension (PECL ssh2), only the following fingerprint algorithms are available via ssh2_fingerprint():

The extension does not expose SHA256 fingerprints, even though the underlying libssh2 library supports it.

As a consequence:

If a SHA256: fingerprint is provided, the connection will fail when strict host key checking is enabled.

This limitation comes from the PHP extension API, not from the library itself.


Retry Policy

Retry is disabled by default (retryMax = 0).

When enabled:

Safe operations are retried:

Unsafe operations are not retried unless explicitly allowed:

Enable unsafe retries:


Common Operations

Upload / Download


Directory Utilities


File Utilities


FTP-only Advanced Listing

Available only on FTP / FTPS:


Authentication

Password

Override credentials:


SFTP Public Key

Only valid for SFTP connections.


Logging

Pass a Psr\Log\LoggerInterface to the factory:

Logged events include:

Credentials are never logged.


Connection Lifecycle

Connections auto-close on destruction.

For long-running scripts:

Safe to call even if not connected.


Architecture

The library follows a clean architecture approach:

This design allows easy mocking and full unit testing.


Quality & Tests

This library is designed for reliability in production environments.

Unit Tests

Run unit tests:

Generate coverage report:


Integration Tests

All protocols are tested against real Dockerized servers.

Protocol Server Tested Features
FTP pure-ftpd Active / Passive / Auto mode, transfers, directory ops, MLSD
FTPS pure-ftpd (TLS required) Explicit TLS, transfers, error cases
SFTP OpenSSH Password auth, public key auth, fingerprint verification

Each integration stack is fully isolated and reproducible.

Run individual protocol tests:

Run all integration tests:

Run everything (unit + integration):


Static Analysis

PHPStan level max (9) with strict rules and bleeding edge enabled:

Configuration includes:


Code Style


CI

All checks are enforced in CI:

Every protocol feature documented in this README is covered by automated tests.


Troubleshooting

FTPS: ftp_ssl_connect() not available

Make sure ext-ftp is compiled with SSL support. ftp_ssl_connect() must be available.

SFTP: host key verification fails

Passive mode issues (FTP/FTPS)

If transfers hang behind NAT/firewalls:

Connection timeouts

Adjust the timeout option depending on network conditions.


Contributing

Contributions are welcome.

Before submitting a pull request:

  1. Ensure all unit tests pass.
  2. Ensure all integration tests pass.
  3. Run PHPStan (level max (9) must remain clean).
  4. Follow existing coding standards.

Useful commands:

Please open an issue first for significant changes or architectural discussions.


Security

If you discover a security vulnerability, please open a GitHub Security Advisory or contact the maintainer privately before disclosing it publicly.

Credentials are never logged by design.

see SECURITY.md.


Roadmap

The project roadmap is maintained separately to keep this README focused and concise.

Full roadmap available here: docs/ROADMAP.md

The roadmap covers:

All roadmap items follow the project principles:

Community feedback is welcome via GitHub Issues and Discussions.


License

MIT — see LICENSE.


All versions of ftp-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
psr/log Version ^3.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 cxxi/ftp-client contains the following files

Loading the files please wait ...