View Full Version : Best way to proceed with FTP operations?

11-08-2007, 12:03 PM
Hi all,

I am currently deciding which way to implement a class that handles FTP transfers.

From reading the PHP manual, I see that I have three options as follows:

1) Use the SSH extension in PECL.
2) Use the ftp built-ins.
3) Use fopen("ftp(s)://username:password@ftp.myserver.com:port", mode);.

Currently I have implemented method 3 because it is far more straight forward than either of the other two.

What, therefore, are the advantages (if any) of the other two methods?

All I am doing is opening an FTP connection, writing a bunch of files and closing the connection - which seems problem-free and very simple using method 3!


11-08-2007, 06:06 PM
The popular saying:

"If it ain't broke, don't fix it"

11-09-2007, 12:41 AM
Lol! Quite ...

11-09-2007, 01:23 AM
From the point of view of the 'user' of your finished class(es), they shouldn't care how the transport happens in the background, so switching in the future (or providing alternatives) shouldn't really be that difficult.

YAGNI (You ain't gonna need it) is another phrase to bear in mind when designing things, don't try and anticipate too much.