@@ -16,18 +16,24 @@ A library that wraps the PHP FTP functions in an OOP way.
1616
1717## Installation
1818
19- The recommended way to install this library is through composer:
19+ The recommended way to install this library is through composer :
2020
2121``` console
2222composer require lazzard/php-ftp-client
2323```
2424
25- or just clone the repo using git:
25+ or just clone the repo using git :
2626
2727``` bash
2828git clone https://github.com/lazzard/php-ftp-client
2929```
3030
31+ then generate the autoload files :
32+
33+ ``` console
34+ composer dump-autoload
35+ ```
36+
3137## Getting Started
3238
3339### Usage
@@ -71,24 +77,24 @@ $client->asyncDownload('illustrations/assets.zip', 'assets.zip', function ($stat
7177
7278// upload a remote file asynchronously
7379$client->asyncUpload('wallpapers.zip', 'public_html', function ($state) {
74- // do something
80+ // do something
7581});
7682```
7783
7884#### listing
7985
8086``` php
8187// get files names within an FTP directory
82- $client->listDirectory ('public_html');
88+ $client->listDir ('public_html');
8389
8490// get only directories
85- $client->listDirectory ('public_html', FtpClient::DIR_TYPE);
91+ $client->listDir ('public_html', FtpClient::DIR_TYPE);
8692
8793// get detailed information of each file within an FTP directory including the file path
88- $client->listDirectoryDetails ('public_html');
94+ $client->listDirDetails ('public_html');
8995
9096// recursively
91- $client->listDirectoryDetails ('public_html', true);
97+ $client->listDirDetails ('public_html', true);
9298```
9399
94100#### remove/rename
@@ -98,16 +104,29 @@ $client->listDirectoryDetails('public_html', true);
98104$client->removeFile($remoteFile);
99105
100106// remove a directory (this will remove all the file within the directory)
101- $client->removeDirectory ($directory);
107+ $client->removeDir ($directory);
102108
103109// rename an FTP file/directory
104110$client->rename($remoteFile, $newName);
105111```
106112
107- #### copy file/directory from local
113+ #### copy
108114``` php
109- // copy a local directory to the giving path in the server
115+ // copy a local file/ directory to server
110116$client->copyFromLocal('media/images', 'htdocs');
117+
118+ // copy a remote file/directory to local machine
119+ $client->copyToLocal('htdocs/images', 'images');
120+ ```
121+
122+ #### search
123+
124+ ``` php
125+ // get all png files within the 'public_html' directory with their details
126+ $client->find('/.*\.png$/i', 'public_html');
127+
128+ // recursively
129+ $client->find('/.*\.png$/i', 'public_html', true);
111130```
112131
113132#### size
@@ -131,7 +150,7 @@ $client->createFile('public_html/example.txt', 'Hello world!!');
131150
132151// create an FTP directory
133152// note: this method supports recursive directory creation
134- $client->createDirectory ('public_html/assets');
153+ $client->createDir ('public_html/assets');
135154```
136155
137156#### remove/rename
@@ -141,7 +160,7 @@ $client->createDirectory('public_html/assets');
141160$client->removeFile($remoteFile);
142161
143162// remove an FTP directory (be careful all the files within this directory will be removed)
144- $client->removeDirectory ($directory);
163+ $client->removeDir ($directory);
145164
146165// rename an FTP file/directory
147166$client->rename($remoteFile, $newName);
@@ -216,11 +235,11 @@ $client->getFeatures();
216235$client->getSystem();
217236
218237// send a request to allocate a space of bytes for the next transfer operation
219- // note: not all servers requires this
238+ // some FTP servers requires this before transfer operations
220239$client->allocateSpace(2048);
221240
222241// prevent the server from closing the connection and keeping it alive
223- $client->keepConnectionAlive ();
242+ $client->keepAlive ();
224243```
225244You can see all available methods [ here] ( docs/FtpClient.md ) .
226245
@@ -270,11 +289,11 @@ try {
270289| Version | Status | Last Release | PHP Version |
271290| ------------| ---------------| --------------| -------------|
272291| 1.0.x | EOL | [ v1.0.2] [ 7 ] | >= 5.5 |
273- | 1.3.x | Latest | [ v1.3.0 ] [ 9 ] | >= 5.6 |
292+ | 1.3.x | Latest | [ v1.3.3 ] [ 9 ] | >= 5.6 |
274293
275294[ 7 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.0.2
276295[ 8 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.1.0
277- [ 9 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.3.0
296+ [ 9 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.3.3
278297
279298## License
280299
0 commit comments