Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fully OO Ftp library for php

Tags:

php

class

ftp

I was trying to build an application that will download some files from various ftp servers to a local directory. Later I would upload them to other ftp servers.

The application is built using Zend framework.

The thing is I can't find a class to handle ftp download/upload functions in Zend framework.

The only class available is Zend_File_Transfer which has the following comment:

Note: Limitation

The current implementation of Zend_File_Transfer is limited to HTTP Post Uploads. Other adapters supporting downloads and other protocols will be added in future releases. Unimplemented methods will throw an exception. For now, you should use Zend_File_Transfer_Adapter_Http directly. As soon as there are multiple adapters available you can use a common interface.

I need to be able to do the following:

  • Upload multiple files.
  • Get a remote directory listing of all files.
  • Set validators
  • Set filters
  • Set paths
  • Rename files
  • Wrapper for downloads
  • Exceptions for various errors during operation.

Is there a solution to this problem in Zend framework? Could you recommend an alternative library for ftp operations ?

Thanks in advance

UPDATE:

  • I checked the PEAR package and unfortunately it's still in alpha release. Moreover their functions return errors not exception once a problem occur like download failure or remote path weren't found.
  • Unfortunately Skjb_Ftp isn't complete as many functions don't have an implementation.
like image 200
Songo Avatar asked Mar 06 '12 09:03

Songo


2 Answers

Check out this php5 wrapper for the builtin FTP functions: https://github.com/dg/ftp-php it has some exception handling stuff you might be able to use.

like image 62
Paul M. Nguyen Avatar answered Sep 28 '22 01:09

Paul M. Nguyen


This is a fully OOP php ftp library i build it in my self (hard working), its unit tested and it will works for your purposes perfectly. php-ftp-client

like image 43
El Amrani Chakir Avatar answered Sep 28 '22 02:09

El Amrani Chakir