PHPackages                             oihana/php-ftp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. oihana/php-ftp

ActiveLibrary[File &amp; Storage](/categories/file-storage)

oihana/php-ftp
==============

The Oihana PHP FTP library - a modern, strongly-typed FTP/FTPS client

1.0.0(today)00MPL-2.0PHPPHP &gt;=8.4CI passing

Since Jun 30Pushed todayCompare

[ Source](https://github.com/BcommeBois/oihana-php-ftp)[ Packagist](https://packagist.org/packages/oihana/php-ftp)[ Docs](https://github.com/BcommeBois/oihana-php-ftp)[ RSS](/packages/oihana-php-ftp/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (2)Used By (0)

Oihana PHP - FTP
================

[](#oihana-php---ftp)

[![Oihana PHP FTP](https://raw.githubusercontent.com/BcommeBois/oihana-php-ftp/main/assets/images/oihana-php-ftp-logo-inline-512x160.png)](https://raw.githubusercontent.com/BcommeBois/oihana-php-ftp/main/assets/images/oihana-php-ftp-logo-inline-512x160.png)

A modern, strongly-typed **FTP / FTPS** client for PHP 8.4+, built in the spirit of the `oihana/php-*` libraries.

[![Latest Version](https://camo.githubusercontent.com/86e217fc78c8ff5d91832d5a74132fc3a646de92cfe53b82367a950398148c62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6968616e612f7068702d6674702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-ftp)
[![Total Downloads](https://camo.githubusercontent.com/d4405147e496586ef8ddf53f2a75ae162718d0588818a58c114bf9fb5ec47799/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6968616e612f7068702d6674702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-ftp)
[![License](https://camo.githubusercontent.com/5b70dc1372625fb31bcfa47fdacd258b9b96ceecc182b0157ff06249486df35e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6968616e612f7068702d6674702e7376673f7374796c653d666c61742d737175617265)](LICENSE)

📚 Documentation
---------------

[](#-documentation)

User guides (FR + EN), with narrative explanations, examples and security notes:

🇬🇧 **[English documentation](wiki/en/README.md)**🇫🇷 **[Documentation française](wiki/fr/README.md)**Getting started, connection, transfers, directories, encryption, architecture, security, testing.Démarrage, connexion, transferts, répertoires, chiffrement, architecture, sécurité, tests.Auto-generated API reference (phpDocumentor):
👉

🚀 Features
----------

[](#-features)

- 🔌 **FTP &amp; FTPS** (explicit TLS) over the native `ext-ftp` extension — zero runtime dependencies.
- 🧩 **Trait-composed client** with a clean, mockable **driver layer** (`FtpDriverInterface`) — SFTP-ready by design.
- 🔑 **Authentication &amp; security** as first-class concerns: credentials are wiped from memory, secrets are never logged.
- 📁 **File &amp; directory operations**: upload, download, append, delete, rename, listing (MLSD/raw), `chmod`, recursive helpers.
- 🧱 **Constant enums everywhere** — no magic strings for config keys, transfer modes or connection options.
- 🪵 **PSR-3 logging** (optional) with retry + exponential backoff on transient failures.
- 🔐 Seamless reuse of **`oihana/php-files`** path/MIME helpers and OpenSSL file encryption.
- 🧪 Full unit-test coverage through the mockable driver — no live server required.

💡 Designed to be lightweight, testable, and compatible with any PHP 8.4+ project.

📦 Installation
--------------

[](#-installation)

> **Requires [PHP 8.4+](https://php.net/releases/)** with the `ext-ftp` extension.

Install via [Composer](https://getcomposer.org):

```
composer require oihana/php-ftp
```

⚡ Usage
-------

[](#-usage)

```
use oihana\ftp\FtpClient ;
use oihana\ftp\enums\Ftp ;
use oihana\ftp\enums\FtpSecurity ;

$client = new FtpClient
([
    Ftp::HOST     => 'ftp.example.org' ,
    Ftp::USERNAME => 'alice' ,
    Ftp::PASSWORD => 's3cr3t' ,
    Ftp::SECURITY => FtpSecurity::SSL , // FTPS over TLS
    Ftp::ROOT     => '/public' ,        // chdir right after login
]) ;

$client->connect() ;

// Transfers
$client->upload( '/local/report.pdf' , 'report.pdf' ) ;
$client->download( 'archive.tar.gz' , '/local/archive.tar.gz' ) ;

// Encrypted transfer (OpenSSL, via oihana/php-files)
$client->uploadEncrypted( '/local/secret.txt' , 'secret.enc' , 'pass-phrase' ) ;

// Directory listing (structured, MLSD with ls -l fallback)
foreach ( $client->listFiles( '/public' ) as $file )
{
    echo $file->name , $file->isDirectory() ? '/' : '' , PHP_EOL ;
}

$client->disconnect() ;
```

> All transport calls go through `FtpDriverInterface`. Inject your own driver as the second constructor argument to unit-test against an in-memory fake, or to plug in an alternative transport later.

✅ Tests &amp; coverage
----------------------

[](#-tests--coverage)

Run the full unit-test suite (PHPUnit, strict mode):

```
composer test
```

Measure coverage (requires Xdebug or PCOV):

```
composer coverage        # text + Clover + HTML under build/coverage/
composer coverage:md     # readable Markdown summary (build/coverage/COVERAGE.md)
```

All transport calls go through `FtpDriverInterface`, so the suite reaches full coverage by mocking an in-memory driver — no real FTP server is needed. See [CONTRIBUTING.md](CONTRIBUTING.md) for the testing philosophy.

🧾 License
---------

[](#-license)

This project is licensed under the [Mozilla Public License 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/).

👤 About the author
------------------

[](#-about-the-author)

- Author : Marc ALCARAZ (aka eKameleon)
- Mail :
- Website :

🛠️ Generate the Documentation
-----------------------------

[](#️-generate-the-documentation)

We use [phpDocumentor](https://phpdoc.org/) to generate the API documentation into the `./docs` folder.

```
composer doc
```

🔗 Related packages
------------------

[](#-related-packages)

- `oihana/php-files` – file, path and OpenSSL helpers reused by this library: `https://github.com/BcommeBois/oihana-php-files`
- `oihana/php-core` – core helpers and utilities: `https://github.com/BcommeBois/oihana-php-core`
- `oihana/php-reflect` – reflection and hydration utilities: `https://github.com/BcommeBois/oihana-php-reflect`
- `oihana/php-enums` – strongly-typed constant enumerations for PHP: `https://github.com/BcommeBois/oihana-php-enums`

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d234506e51778dd3d1d61b6c2af6f294ff963651b4aa509b595d3d2a77b7d89b?d=identicon)[ooop](/maintainers/ooop)

---

Top Contributors

[![ekameleon](https://avatars.githubusercontent.com/u/749032?v=4)](https://github.com/ekameleon "ekameleon (11 commits)")

---

Tags

file-transferfilesystemftpftp-clientftpsoihanaphpphp8psr-3remote-filessftp-readysslstrongly-typedtlsphpftptlsftpsftp-clientfile-transfer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oihana-php-ftp/health.svg)

```
[![Health](https://phpackages.com/badges/oihana-php-ftp/health.svg)](https://phpackages.com/packages/oihana-php-ftp)
```

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k665.7M2.4k](/packages/league-flysystem)[lazzard/php-ftp-client

This library provides helper classes and methods to manage your FTP files in an OOP way.

91226.6k](/packages/lazzard-php-ftp-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
