PHPackages                             dg/ftp-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dg/ftp-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

dg/ftp-php
==========

Easy-to-use library for accessing FTP servers

v2.0.0(3y ago)202730.8k↓45.2%78[1 PRs](https://github.com/dg/ftp-php/pulls)3BSD-3-ClausePHPPHP &gt;=8.1

Since Aug 31Pushed 1mo ago18 watchersCompare

[ Source](https://github.com/dg/ftp-php)[ Packagist](https://packagist.org/packages/dg/ftp-php)[ Docs](https://github.com/dg/ftp-php)[ RSS](/packages/dg-ftp-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)DependenciesVersions (7)Used By (3)

FTP for PHP
===========

[](#ftp-for-php)

[![Downloads this Month](https://camo.githubusercontent.com/2d2893ba609a83872b5a4a87d9ff46bac10524b1277c2fbb8e7d3fcc6b50662f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f64672f6674702d7068702e737667)](https://packagist.org/packages/dg/ftp-php)[![Latest Stable Version](https://camo.githubusercontent.com/75849350fd0cc422a399baaa50e5eec1bd3bd4029b0068fcddb77a8c444a86bf/68747470733a2f2f706f7365722e707567782e6f72672f64672f6674702d7068702f762f737461626c65)](https://github.com/dg/ftp-php/releases)[![License](https://camo.githubusercontent.com/fa7d5fcf2c84b580327af52da95dd751703af65f079dc3c5a0081beac0789718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4e65772532304253442d626c75652e737667)](https://github.com/dg/ftp-php/blob/master/license.md)

FTP for PHP is a very small and easy-to-use library for accessing FTP servers.

It requires PHP 8.1 or newer and is licensed under the New BSD License. You can obtain the latest version from our [GitHub repository](https://github.com/dg/ftp-php/releases)or install it via Composer:

```
php composer.phar require dg/ftp-php

```

If you like it, **[please make a donation now](https://nette.org/make-donation?to=ftp-php)**. Thank you!

Usage
-----

[](#usage)

Opens an FTP connection to the specified host:

```
$ftp = new Ftp;
$host = 'ftp.example.com';
$ftp->connect($host);
```

Login with username and password

```
$ftp->login($username, $password);
```

Upload the file

```
$ftp->put($destinationFile, $sourceFile, Ftp::Binary);
```

Close the FTP stream

```
$ftp->close();
// or simply unset($ftp);
```

Ftp throws exception if operation failed. So you can simply do following:

```
try {
	$ftp = new Ftp;
	$ftp->connect($host);
	$ftp->login($username, $password);
	$ftp->put($destinationFile, $sourceFile, Ftp::Binary);

} catch (FtpException $e) {
	echo 'Error: ', $e->getMessage();
}
```

On the other hand, if you'd like the possible exception quietly catch, call methods with the prefix `try`:

```
$ftp->tryDelete($destinationFile);
```

When the connection is accidentally interrupted, you can re-establish it using method `$ftp->reconnect()`.

---

(c) David Grudl, 2008, 2023 ()

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance61

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 79.3% 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 ~794 days

Recently: every ~833 days

Total

6

Last Release

1127d ago

Major Versions

v1.2.2 → v2.0.02023-07-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f266513a3ca97500ec3d85d562b9279c7a6346358fe2b8d90390ece717a027?d=identicon)[david@grudl.com](/maintainers/david@grudl.com)

---

Top Contributors

[![dg](https://avatars.githubusercontent.com/u/194960?v=4)](https://github.com/dg "dg (23 commits)")[![janmarek](https://avatars.githubusercontent.com/u/150257?v=4)](https://github.com/janmarek "janmarek (1 commits)")[![Kaczmi](https://avatars.githubusercontent.com/u/17334817?v=4)](https://github.com/Kaczmi "Kaczmi (1 commits)")[![stanislav-janu](https://avatars.githubusercontent.com/u/5769861?v=4)](https://github.com/stanislav-janu "stanislav-janu (1 commits)")[![uestla](https://avatars.githubusercontent.com/u/373888?v=4)](https://github.com/uestla "uestla (1 commits)")[![webArtisan](https://avatars.githubusercontent.com/u/5076209?v=4)](https://github.com/webArtisan "webArtisan (1 commits)")[![Wilt](https://avatars.githubusercontent.com/u/2419627?v=4)](https://github.com/Wilt "Wilt (1 commits)")

---

Tags

ftpphpftp

### Embed Badge

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

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

###  Alternatives

[league/uri

URI manipulation library

1.1k252.7M429](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

542251.3M50](/packages/league-uri-interfaces)[altayalp/ftp-client

FTP and SFTP client for Php

1974.7k](/packages/altayalp-ftp-client)

PHPackages © 2026

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