Skip to content

Commit b5281a5

Browse files
committed
README.md Updated
1 parent bd1ba1d commit b5281a5

File tree

1 file changed

+48
-57
lines changed

1 file changed

+48
-57
lines changed

README.md

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Lazzard/FtpClient
22

3-
[![Downloads](https://img.shields.io/packagist/dm/lazzard/php-ftp-client)](https://packagist.org/packages/lazzard/php-ftp-client)
3+
[![Downloads](https://img.shields.io/packagist/dt/lazzard/php-ftp-client?style=flat-square)](https://packagist.org/packages/lazzard/php-ftp-client)
44
[![Packagist Version](https://img.shields.io/packagist/v/lazzard/php-ftp-client?style=flat-square)](https://packagist.org/packages/lazzard/php-ftp-client)
55
[![Minimum PHP version](https://img.shields.io/packagist/php-v/lazzard/php-ftp-client?color=%238892bf&style=flat-square)](https://packagist.org/packages/lazzard/php-ftp-client)
66
![License](https://img.shields.io/packagist/l/lazzard/php-ftp-client?color=critical&style=flat-square)
77

88
A library that wraps the PHP FTP functions in an OOP way.
99

10-
*Note: This library aimed to be a full FTP/FTPS client solution for the old (5.5+) and newer PHP releases (7.2+) that support FTP extension.*
10+
*Note: This library aimed to be a full FTP/FTPS client solution for the old (5.5+) and newer PHP releases (8.0+) that support FTP extension.*
1111

1212
## Requirements
1313

@@ -34,35 +34,45 @@ then generate the autoload files :
3434
composer dump-autoload
3535
```
3636

37-
## Getting Started
37+
## Quick Start
3838

39-
### Usage
40-
41-
Create an FTP connection
4239
```php
43-
$connection = new FtpConnection('host', 'foo', '1234');
44-
$connection->open();
45-
```
40+
<?php
4641

47-
Or create a secure FTP connection
48-
```php
49-
$connection = new FtpSSLConnection('host', 'bar', '1234');
50-
$connection->open();
51-
```
42+
require __DIR__ . '/vendor/autoload.php';
5243

53-
Configure the connection
44+
use Lazzard\FtpClient\Config\FtpConfig;
45+
use Lazzard\FtpClient\Connection\FtpConnection;
46+
use Lazzard\FtpClient\Connection\FtpSSLConnection;
47+
use Lazzard\FtpClient\Exception\FtpClientException;
48+
use Lazzard\FtpClient\FtpClient;
5449

55-
```php
56-
$config = new FtpConfig(ConnectionInterface $connection);
57-
$config->setPassive(true);
58-
```
50+
try {
51+
// create a regular FTP connection
52+
$connection = new FtpConnection("host", "username", "password");
53+
// or a secure connection
54+
$connection = new FtpSSLConnection("host", "username", "password");
55+
// open the connection
56+
$connection->open();
57+
58+
// configure the FTP connection
59+
$config = new FtpConfig($connection);
60+
// set the passive mode on (recommanded)
61+
$config->setPassive(true);
5962

60-
Start working with the base class `FtpClient`
63+
// Start working
64+
$client = new FtpClient($connection);
65+
print_r($client->getFeatures());
6166

62-
```php
63-
$client = new FtpClient(ConnectionInterface $connection);
67+
// close the connection
68+
$connection->close();
69+
} catch (FtpClientException $ex) { // catch this library exceptions with the 'FtpClientException' exception class
70+
print_r($ex->getMessage());
71+
}
6472
```
6573

74+
## Usage
75+
6676
#### upload/download
6777

6878
```php
@@ -71,7 +81,11 @@ $client->download('path/to/remote/file', 'path/to/local/file');
7181

7282
// upload a local file to remote server
7383
$client->upload('path/to/local/file', 'path/to/remote/file');
84+
```
85+
86+
#### Asynchrounous upload/download
7487

88+
```php
7589
// download a remote file asynchronously
7690
$client->asyncDownload('path/to/remote/file', 'path/to/local/file', function ($state) {
7791
// do something every second while downloading this file
@@ -83,6 +97,8 @@ $client->asyncUpload('path/to/local/file', 'path/to/remote/file', function ($sta
8397
}, 1, FtpWrapper::BINARY);
8498
```
8599

100+
*Find more about asynchrounous stuff [here](docs/FtpClient.md#asynchronous-transfer-operations).*
101+
86102
#### listing
87103

88104
```php
@@ -235,43 +251,18 @@ $client->allocateSpace(2048);
235251
// prevent the server from closing the connection and keeping it alive
236252
$client->keepAlive();
237253
```
238-
You can see all available methods [here](docs/FtpClient.md).
239-
240-
## Full example
241-
242-
```php
243-
try {
244-
// Connection
245-
$connection = new FtpConnection("localhost", "foo", "12345");
246-
$connection->open();
247-
248-
// Configuration
249-
$config = new FtpConfig($connection);
250-
$config->setPassive(true);
251-
252-
// FtpClient
253-
$client = new FtpClient($connection);
254-
255-
// Start working
256-
print_r($client->getFeatures());
257-
258-
// Close connection
259-
$connection->close();
260-
} catch (FtpClientException $ex) { // Use FtpClientException to catch this library exceptions
261-
echo($ex->getMessage());
262-
}
263-
```
254+
*You can see all available methods [here](docs/FtpClient.md).*
264255

265256
## More documentation
266257

267-
* [Manipulate an FTP connection with **FtpConnectionInterface**][1]
268-
* [Configure the connection instance with **FtpConfig**][2]
269-
* [Start working with the base class **FtpClient**][3]
270-
* [Sending FTP commands with **FtpCommand**][4]
271-
* [Using the **FtpWrapper** Directly][5]
272-
* [How i can run test units ?][6]
258+
* [Manipulate the FTP connection with **ConnectionInterface**.][1]
259+
* [Configure the connection instance with **FtpConfig**.][2]
260+
* [Start working with the base class **FtpClient**.][3]
261+
* [Sending FTP commands with **FtpCommand**.][4]
262+
* [How to use the **FtpWrapper** class directly.][5]
263+
* [Running the integration tests.][6]
273264

274-
[1]: docs/FtpConnectionInterface.md
265+
[1]: docs/ConnectionInterface.md
275266
[2]: docs/FtpConfig.md
276267
[3]: docs/FtpClient.md
277268
[4]: docs/FtpCommand.md
@@ -283,11 +274,11 @@ try {
283274
| Version | Status | Last Release | PHP Version |
284275
|------------|---------------|--------------|-------------|
285276
| 1.0.x | EOL | [v1.0.2][7] | >= 5.5 |
286-
| 1.3.x | Latest | [v1.3.5][9] | >= 5.6 |
277+
| 1.4.x | Latest | [v1.4.0][9] | >= 5.6 |
287278

288279
[7]: https://github.com/lazzard/php-ftp-client/releases/tag/v1.0.2
289280
[8]: https://github.com/lazzard/php-ftp-client/releases/tag/v1.1.0
290-
[9]: https://github.com/lazzard/php-ftp-client/releases/tag/v1.3.5
281+
[9]: https://github.com/lazzard/php-ftp-client/releases/tag/v1.4.0
291282

292283
## License
293284

0 commit comments

Comments
 (0)