xp-framework / ftp
FTP protocol support for the XP Framework
Installs: 43 612
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
- xp-framework/core: ^12.0 | ^11.0 | ^10.0
- xp-framework/io-collections: ^10.0 | ^9.0 | ^8.0
- xp-framework/logging: ^11.0 | ^10.0 | ^9.1
- xp-framework/networking: ^10.0 | ^9.3
Requires (Dev)
- xp-framework/unittest: ^11.0 | ^10.1
README
Userland FTP protocol implementation, no dependency on PHP's ftp extension.
Client
Example: Uploading
use peer\ftp\{FtpConnection, FtpTransfer}; use io\File; $c= (new FtpConnection('ftp://user:pass@example.com/'))->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
use peer\ftp\FtpConnection; $c= (new FtpConnection('ftp://user:pass@example.com/'))->connect(); // List root directory's contents foreach ($c->rootDir()->entries() as $entry) { Console::writeLine('- ', $entry); } $c->close();