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

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

simplicity-ag/php-ftp-client
============================

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

2.0.0(9y ago)015MITPHPPHP &gt;=5.4

Since Jul 11Pushed 9y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (9)Used By (0)

nicolab/php-ftp-client
======================

[](#nicolabphp-ftp-client)

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

Install
-------

[](#install)

- Use composer: *require* `nicolab/php-ftp-client`
- Or use GIT clone command: `git clone git@github.com:Nicolab/php-ftp-client.git`
- Or download the library, configure your autoloader or include the 3 files of `php-ftp-client/src/FtpClient` directory.

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

[](#getting-started)

Connect to a server FTP :

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

OR

Connect to a server FTP via SSL (on port 22 or other port) :

```
$ftp = new \FtpClient\FtpClient();
$ftp->connect($host, true, 22);
$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 all directories is easy :

```
// upload with the BINARY mode
$ftp->putAll($source_directory, $target_directory);

// Is equal to
$ftp->putAll($source_directory, $target_directory, FTP_BINARY);

// or upload with the ASCII mode
$ftp->putAll($source_directory, $target_directory, 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->count();

// count in a given directory
$total = $ftp->count('/path/of/directory');

// count only the "files" in the current directory
$total_file = $ftp->count('.', 'file');

// count only the "files" in a given directory
$total_file = $ftp->count('/path/of/directory', 'file');

// count only the "directories" in a given directory
$total_dir = $ftp->count('/path/of/directory', 'directory');

// count only the "symbolic links" in a given directory
$total_link = $ftp->count('/path/of/directory', 'link');
```

Detailed list of all files and directories :

```
// scan the current directory and returns the details of each item
$items = $ftp->scanDir();

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

Result:

```
'directory#www' =>
    array (size=10)
      'permissions' => string 'drwx---r-x' (length=10)
      'number'      => string '3' (length=1)
      'owner'       => string '32385' (length=5)
      'group'       => string 'users' (length=5)
      'size'        => string '5' (length=1)
      'month'       => string 'Nov' (length=3)
      'day'         => string '24' (length=2)
      'time'        => string '17:25' (length=5)
      'name'        => string 'www' (length=3)
      'type'        => string 'directory' (length=9)

  'link#www/index.html' =>
    array (size=11)
      'permissions' => string 'lrwxrwxrwx' (length=10)
      'number'      => string '1' (length=1)
      'owner'       => string '0' (length=1)
      'group'       => string 'users' (length=5)
      'size'        => string '38' (length=2)
      'month'       => string 'Nov' (length=3)
      'day'         => string '16' (length=2)
      'time'        => string '14:57' (length=5)
      'name'        => string 'index.html' (length=10)
      'type'        => string 'link' (length=4)
      'target'      => string '/var/www/shared/index.html' (length=26)

'file#www/README' =>
    array (size=10)
      'permissions' => string '-rw----r--' (length=10)
      'number'      => string '1' (length=1)
      'owner'       => string '32385' (length=5)
      'group'       => string 'users' (length=5)
      'size'        => string '0' (length=1)
      'month'       => string 'Nov' (length=3)
      'day'         => string '24' (length=2)
      'time'        => string '17:25' (length=5)
      'name'        => string 'README' (length=6)
      'type'        => string 'file' (length=4)

```

All FTP PHP functions are supported and some improved :

```
// Requests execution of a command on the FTP server
$ftp->exec($command);

// Turns passive mode on or off
$ftp->pasv(true);

// Set permissions on a file via FTP
$ftp->chmod('0777', 'file.php');

// Removes a directory
$ftp->rmdir('path/of/directory/to/remove');

// Removes a directory (recursive)
$ftp->rmdir('path/of/directory/to/remove', true);

// Creates a directory
$ftp->mkdir('path/of/directory/to/create');

// Creates a directory (recursive),
// creates automaticaly the sub directory if not exist
$ftp->mkdir('path/of/directory/to/create', true);

// and more ...
```

Get the help information of remote FTP server :

```
var_dump($ftp->help());
```

Result :

```
array (size=6)
  0 => string '214-The following SITE commands are recognized' (length=46)
  1 => string ' ALIAS' (length=6)
  2 => string ' CHMOD' (length=6)
  3 => string ' IDLE' (length=5)
  4 => string ' UTIME' (length=6)
  5 => string '214 Pure-FTPd - http://pureftpd.org/' (length=36)

```

*Note : The result depend of FTP server.*

### Extend

[](#extend)

Create your custom `FtpClient`.

```
// MyFtpClient.php

/**
 * My custom FTP Client
 * @inheritDoc
 */
class MyFtpClient extends \FtpClient\FtpClient {

  public function removeByTime($path, $timestamp) {
      // your code here
  }

  public function search($regex) {
      // your code here
  }
}
```

```
// example.php
$ftp = new MyFtpClient();
$ftp->connect($host);
$ftp->login($login, $password);

// remove the old files
$ftp->removeByTime('/www/mysite.com/demo', time() - 86400));

// search PNG files
$ftp->search('/(.*)\.png$/i');
```

API doc
-------

[](#api-doc)

See the [source code](https://github.com/Nicolab/php-ftp-client/tree/master/src/FtpClient) for more details. It is fully documented 📘

Testing
-------

[](#testing)

Tested with "atoum" unit testing framework.

License
-------

[](#license)

[MIT](https://github.com/Nicolab/php-ftp-client/blob/master/LICENSE) c) 2014, Nicolas Tallefourtane.

Author
------

[](#author)

[![Nicolas Tallefourtane - Nicolab.net](https://camo.githubusercontent.com/03b0aa01a190618acc57432930c9ca7d8b3cec2152fed75890604db5398820f6/687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f64376464306634373639663361613438613365636233303866306234353766633f733d3634)](http://nicolab.net)[Nicolas Talle](http://nicolab.net)[![Make a donation via Paypal](https://camo.githubusercontent.com/7b6de155df30b37b25eb5fec52f9213680c3dbf067dfb7d7e2850ac4096c7d05/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e6174655f534d2e676966)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PGRH4ZXP36GUC)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

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

Every ~117 days

Recently: every ~206 days

Total

8

Last Release

3495d ago

Major Versions

v1.3.0 → 2.0.02016-10-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/56226e9d6f92aa87fa921dde26b4242286749412db10021a69e17f1ede749184?d=identicon)[simplyibo](/maintainers/simplyibo)

---

Top Contributors

[![Nicolab](https://avatars.githubusercontent.com/u/1688162?v=4)](https://github.com/Nicolab "Nicolab (19 commits)")[![vlakoff](https://avatars.githubusercontent.com/u/544424?v=4)](https://github.com/vlakoff "vlakoff (2 commits)")[![Laurent-Sarrazin](https://avatars.githubusercontent.com/u/1137846?v=4)](https://github.com/Laurent-Sarrazin "Laurent-Sarrazin (2 commits)")[![simplymathjes](https://avatars.githubusercontent.com/u/22833186?v=4)](https://github.com/simplymathjes "simplymathjes (2 commits)")[![GuillermoMI](https://avatars.githubusercontent.com/u/6951800?v=4)](https://github.com/GuillermoMI "GuillermoMI (1 commits)")[![hollodotme](https://avatars.githubusercontent.com/u/1557839?v=4)](https://github.com/hollodotme "hollodotme (1 commits)")[![hubdotcom](https://avatars.githubusercontent.com/u/5274747?v=4)](https://github.com/hubdotcom "hubdotcom (1 commits)")[![koenhoeijmakers](https://avatars.githubusercontent.com/u/2232776?v=4)](https://github.com/koenhoeijmakers "koenhoeijmakers (1 commits)")

---

Tags

ftphelpersftpserverfilessllibssl-ftp

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/simplicity-ag-php-ftp-client/health.svg)](https://phpackages.com/packages/simplicity-ag-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)[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)[league/flysystem

File storage abstraction for PHP

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

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-ftp

FTP filesystem adapter for Flysystem.

2820.8M101](/packages/league-flysystem-ftp)

PHPackages © 2026

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