https://github.com/xp-framework/ftp
FTP protocol support for the XP Framework
https://github.com/xp-framework/ftp
client ftp php php7 php8 server xp-framework
Last synced: 22 days ago
JSON representation
FTP protocol support for the XP Framework
- Host: GitHub
- URL: https://github.com/xp-framework/ftp
- Owner: xp-framework
- Created: 2013-11-12T11:06:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-03-24T10:37:09.000Z (about 1 year ago)
- Last Synced: 2025-04-14T07:18:46.737Z (about 1 month ago)
- Topics: client, ftp, php, php7, php8, server, xp-framework
- Language: PHP
- Homepage:
- Size: 3.29 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
FTP protocol support for the XP Framework
========================================================================[](https://github.com/xp-framework/ftp/actions)
[](https://github.com/xp-framework/core)
[](https://github.com/xp-framework/core/blob/master/LICENCE.md)
[](http://php.net/)
[](http://php.net/)
[](https://packagist.org/packages/xp-framework/ftp)Userland FTP protocol implementation, no dependency on PHP's *ftp* extension.
Client
------### Example: Uploading
```php
use peer\ftp\{FtpConnection, FtpTransfer};
use io\File;$c= (new FtpConnection('ftp://user:[email protected]/'))->connect();
// Upload logo.png to the connection's root directory
$c->rootDir()->file('logo.png')->uploadFrom(new File('logo.png'));// Upload from a stream using ASCII mode
$c->rootDir()->file('README.md')->uploadFrom(
new MemoryInputStream('Read me first!'),
FtpTransfer::ASCII
);$c->close();
```### Example: Listing
```php
use peer\ftp\FtpConnection;$c= (new FtpConnection('ftp://user:[email protected]/'))->connect();
// List root directory's contents
foreach ($c->rootDir()->entries() as $entry) {
Console::writeLine('- ', $entry);
}$c->close();
```