PHPackages                             tomedio/php-ftp-client - 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. tomedio/php-ftp-client

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

tomedio/php-ftp-client
======================

A modern FTP and SSL-FTP client for PHP, offering easy-to-use helpers for managing remote files.

v1.0.0(1y ago)148MITPHPPHP &gt;=8.1

Since Oct 9Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/tomedio/php-ftp-client)[ Packagist](https://packagist.org/packages/tomedio/php-ftp-client)[ Docs](https://github.com/tomedio/php-ftp-client)[ RSS](/packages/tomedio-php-ftp-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

tomedio/php-ftp-client
======================

[](#tomediophp-ftp-client)

[![Latest Stable Version](https://camo.githubusercontent.com/27aaeaf5bf44bc46e72adcb0c7378c598f8cd235a8d8b70d8579fe4c5e09fe42/68747470733a2f2f706f7365722e707567782e6f72672f746f6d6564696f2f7068702d6674702d636c69656e742f762f737461626c65)](https://packagist.org/packages/tomedio/php-ftp-client)[![Total Downloads](https://camo.githubusercontent.com/3d0845823c0b61762e952f31ecb97e4a4abf0984ba9fe8ad2745f2ba9d6ab84f/68747470733a2f2f706f7365722e707567782e6f72672f746f6d6564696f2f7068702d6674702d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/tomedio/php-ftp-client)[![License](https://camo.githubusercontent.com/97a18c6c653dd87397f1ac0f46dac47debf19d48457be9206b69aa0c338363c8/68747470733a2f2f706f7365722e707567782e6f72672f746f6d6564696f2f7068702d6674702d636c69656e742f6c6963656e7365)](https://packagist.org/packages/tomedio/php-ftp-client)[![PHP Version](https://camo.githubusercontent.com/04744bae0a61d2ffe29c26f07a9612eae20445fc6feaeb77b3af1f0e9be6447c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d3838393242462e737667)](https://php.net/)

A modern FTP and SSL-FTP client for PHP, offering easy-to-use helpers for managing remote files.

> Note: This library requires PHP &gt;=8.1.

Installation
------------

[](#installation)

To get started with PHP FTP Client in your project, you can install it via Composer:

```
composer require tomedio/php-ftp-client
```

After installation, you can use the library in your PHP project to connect to an FTP server and perform various operations.

Getting Started
---------------

[](#getting-started)

Connect to an FTP server:

```
$ftp = new \FtpClient\FtpClient();
$ftp->connect($host);
$ftp->login($login, $password);
```

OR

Connect to an FTP server via SSL (on port 990 or another port):

```
$ftp = new \FtpClient\FtpClient();
$ftp->connect($host, true, 990);
$ftp->login($login, $password);
```

Note: The connection is implicitly closed at the end of script execution (when the object is destroyed). Therefore, it is unnecessary to call `$ftp->close()`, except for an explicit re-connection.

### Usage

[](#usage)

Upload all files and directories:

```
// Upload with the BINARY mode
$ftp->putAll($sourceDirectory, $targetDirectory);

// Is equal to
$ftp->putAll($sourceDirectory, $targetDirectory, FTP_BINARY);

// Or upload with the ASCII mode
$ftp->putAll($sourceDirectory, $targetDirectory, FTP_ASCII);
```

*Note: FTP\_ASCII and FTP\_BINARY are predefined PHP internal constants.*

Get a directory size:

```
// Size of the current directory
$size = $ftp->dirSize();

// Size of a given directory
$size = $ftp->dirSize('/path/of/directory');
```

Count the items in a directory:

```
// Count in the current directory
$total = $ftp->countItems();

// Or alias
$total = $ftp->count();
```

Detailed list of all files and directories in a directory:

```
$items = $ftp->scanDir();

// scan the current directory (recursive) and returns the details of each item
var_dump($ftp->scanDir('.', true));
```

Results:

```
'directory#public' =>
    array (size=10)
      'permissions' => string 'drwxr-xr-x' (length=10)
      'number'      => string '2' (length=1)
      'owner'       => string '1000' (length=4)
      'group'       => string 'staff' (length=5)
      'size'        => string '4096' (length=4)
      'month'       => string 'Dec' (length=3)
      'day'         => string '12' (length=2)
      'time'        => string '10:15' (length=5)
      'name'        => string 'public' (length=6)
      'type'        => string 'directory' (length=9)

'link#public/logo.png' =>
    array (size=11)
      'permissions' => string 'lrwxrwxrwx' (length=10)
      'number'      => string '1' (length=1)
      'owner'       => string '1000' (length=4)
      'group'       => string 'staff' (length=5)
      'size'        => string '20' (length=2)
      'month'       => string 'Dec' (length=3)
      'day'         => string '10' (length=2)
      'time'        => string '09:30' (length=5)
      'name'        => string 'logo.png' (length=8)
      'type'        => string 'link' (length=4)
      'target'      => string '/var/www/shared/logo.png' (length=24)

'file#public/index.php' =>
    array (size=10)
      'permissions' => string '-rw-r--r--' (length=10)
      'number'      => string '1' (length=1)
      'owner'       => string '1000' (length=4)
      'group'       => string 'staff' (length=5)
      'size'        => string '1234' (length=4)
      'month'       => string 'Dec' (length=3)
      'day'         => string '12' (length=2)
      'time'        => string '10:15' (length=5)
      'name'        => string 'index.php' (length=9)
      'type'        => string 'file' (length=4)

```

Upload a file to the FTP server:

```
$ftp->put($localFile, $remoteFile);
```

Download a file from the FTP server:

```
$ftp->get($remoteFile, $localFile);
```

Delete a file from the FTP server:

```
$ftp->delete($file);
```

Delete a directory from the FTP server:

```
$ftp->deleteDir($directory);
```

Create a directory on the FTP server:

```
$ftp->makeDir($directory);
```

Rename a file or directory on the FTP server:

```
$ftp->rename($oldName, $newName);
```

Change the permissions of a file or directory on the FTP server:

```
$ftp->chmod($mode, $file);
```

Change the owner of a file or directory on the FTP server:

```
$ftp->chown($owner, $file);
```

Change the group of a file or directory on the FTP server:

```
$ftp->chgrp($group, $file);
```

Get the last modified time of a file or directory on the FTP server:

```
$ftp->mdtm($file);
```

Get the size of a file on the FTP server:

```
$ftp->size($file);
```

Get the system type of the FTP server:

```
$ftp->systype();
```

Get the current working directory on the FTP server:

```
$ftp->pwd();
```

Change the current working directory on the FTP server:

```
$ftp->chdir($directory);
```

List the contents of the current directory on the FTP server:

```
$ftp->nlist();
```

List the contents of a directory on the FTP server:

```
$ftp->nlist($directory);
```

### Error Handling

[](#error-handling)

The library throws exceptions when an error occurs. You can catch exceptions to handle errors in your application:

```
try {
    // Code that may throw an exception
} catch (\FtpClient\FtpException $e) {
    // Handle the exception
    echo 'An error occurred: ' . $e->getMessage();
}
```

License
-------

[](#license)

PHP FTP Client is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance44

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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

586d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/29e4496bfcaa52ce81b84c6b7782c485a60b955ed0e96f7b52622e620e6baf4f?d=identicon)[tomedio](/maintainers/tomedio)

---

Top Contributors

[![tbajorek](https://avatars.githubusercontent.com/u/11332657?v=4)](https://github.com/tbajorek "tbajorek (7 commits)")[![tbajorek-tomedio](https://avatars.githubusercontent.com/u/136159657?v=4)](https://github.com/tbajorek-tomedio "tbajorek-tomedio (3 commits)")

---

Tags

ftphelpersftplibraryserverfilesslphp8ssl-ftp

### Embed Badge

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

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

###  Alternatives

[nicolab/php-ftp-client

A flexible FTP and SSL-FTP client for PHP. This lib provides helpers easy to use to manage the remote files.

6435.3M24](/packages/nicolab-php-ftp-client)[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[yii2mod/yii2-ftp

A flexible FTP and SSL-FTP client for PHP. This lib provides helpers easy to use to manage the remote files.

32433.0k3](/packages/yii2mod-yii2-ftp)

PHPackages © 2026

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