1
1
# Lazzard/FtpClient
2
2
3
- [ ![ Downloads] ( https://img.shields.io/packagist/dt/lazzard/php-ftp-client?style=flat-square )] ( https://packagist.org/packages/lazzard/php-ftp-client )
4
- [ ![ Packagist Version] ( https://img.shields.io/packagist/v/lazzard/php-ftp-client?style=flat-square )] ( https://packagist.org/packages/lazzard/php-ftp-client )
5
- [ ![ 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 )
6
- ![ License] ( https://img.shields.io/packagist/l/lazzard/php-ftp-client?color=critical&style=flat-square )
3
+ [ ![ Downloads] ( https://img.shields.io/packagist/dt/lazzard/php-ftp-client )] ( https://packagist.org/packages/lazzard/php-ftp-client )
4
+ [ ![ Packagist Version] ( https://img.shields.io/packagist/v/lazzard/php-ftp-client )] ( https://packagist.org/packages/lazzard/php-ftp-client )
5
+ [ ![ Minimum PHP version] ( https://img.shields.io/packagist/php-v/lazzard/php-ftp-client?color=%238892bf )] ( https://packagist.org/packages/lazzard/php-ftp-client )
6
+ ![ License] ( https://img.shields.io/packagist/l/lazzard/php-ftp-client )
7
7
8
- A library that wraps the PHP FTP functions in an OOP way.
8
+ This library provides helper classes and methods to manage your files on the FTP server in an OOP way.
9
9
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.*
11
-
12
- ## Requirements
13
-
14
- * PHP version >= 5.6.0.
15
- * FTP extension enabled.
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.*
16
11
17
12
## Installation
18
13
19
14
The recommended way to install this library is through composer :
20
15
21
- ``` console
22
- composer require lazzard/php-ftp-client
23
- ```
24
-
25
- or just clone the repo using git :
26
-
27
- ``` bash
28
- git clone https://github.com/lazzard/php-ftp-client
29
16
```
30
-
31
- then generate the autoload files :
32
-
33
- ``` console
34
- composer dump-autoload
17
+ composer require lazzard/php-ftp-client
35
18
```
36
19
37
20
## Quick Start
@@ -41,32 +24,24 @@ composer dump-autoload
41
24
42
25
require __DIR__ . '/vendor/autoload.php';
43
26
44
- use Lazzard\FtpClient\Connection\FtpConnection;
45
27
use Lazzard\FtpClient\Connection\FtpSSLConnection;
46
28
use Lazzard\FtpClient\Config\FtpConfig;
47
29
use Lazzard\FtpClient\FtpClient;
48
30
use Lazzard\FtpClient\Exception\FtpClientException;
49
31
50
32
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
33
+ $connection = new FtpSSLConnection('host', 'username', 'password');
56
34
$connection->open();
57
35
58
- // configure the FTP connection
59
36
$config = new FtpConfig($connection);
60
- // set the passive mode on (recommanded)
61
37
$config->setPassive(true);
62
38
63
- // Start working
64
39
$client = new FtpClient($connection);
40
+
65
41
print_r($client->getFeatures());
66
-
67
- // close the connection
42
+
68
43
$connection->close();
69
- } catch (FtpClientException $ex) { // catch this library exceptions with the 'FtpClientException' exception class
44
+ } catch (FtpClientException $ex) {
70
45
print_r($ex->getMessage());
71
46
}
72
47
```
@@ -236,7 +211,7 @@ $client->isFeatureSupported('SIZE');
236
211
$client->lastMTime('path/to/file');
237
212
238
213
// get a content of an FTP file
239
- $client->getFileContent('path/to/file');
214
+ $client->getFileContent('path/to/file', FtpWrapper::ASCII );
240
215
241
216
// get all supported features by the FTP server
242
217
$client->getFeatures();
@@ -271,14 +246,19 @@ $client->keepAlive();
271
246
272
247
## Version Guidance
273
248
274
- | Version | Status | Last Release | PHP Version |
275
- | ------------| ---------------| --------------| -------------|
276
- | 1.0.x | EOL | [ v1.0.2] [ 7 ] | >= 5.5 |
277
- | 1.4.x | Latest | [ v1.4.2] [ 9 ] | >= 5.6 |
249
+ | Version | Status | Last Release | PHP Version |
250
+ | :----------:| :-------------:| :------------:| :-------------:|
251
+ | 1.0.x | EOL | [ v1.0.2] [ 7 ] | >= 5.5 |
252
+ | 1.4.x | EOL | [ v1.4.2] [ 9 ] | >= 5.6 |
253
+ | 1.5.x | Latest | [ v1.5.0] [ 9 ] | ^7.2 \| 8.0.* |
278
254
279
255
[ 7 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.0.2
280
256
[ 8 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.1.0
281
- [ 9 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.4.2
257
+ [ 9 ] : https://github.com/lazzard/php-ftp-client/releases/tag/v1.5.0
258
+
259
+ ## Contribution
260
+
261
+ Feel free to fork this repo if you want to enhance it or adding new features, also reported some issues that may have you facing while using the library will be very appreciated, Thank you!
282
262
283
263
## License
284
264
0 commit comments