Skip to content

Commit 4bc937a

Browse files
authored
Merge pull request #24 from lazzard/1.5
1.5
2 parents 024272d + 00abb8c commit 4bc937a

26 files changed

+1135
-750
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
vendor
1+
vendor
2+
.phpunit.result.cache

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## 1.5.0 (2021-10-08)
4+
5+
* Upgraded the code base to PHP v7.2.
6+
* Upgraded PHPUnit to ^8.0.
7+
* `FtpCommand::raw` is now throw exception in failure.
8+
* `FtpWrapper::getErrorMessage` returns empty string instead of null if no error message is available.
9+
* `FtpClient::getFeatures` throws exception in failure.
10+
* Fixed `FtpClient::createDir` for multiple directory creation.
11+
* `FtpClient::getFileContent` now throws exception if the passed file is a directory type instead of returning false value.
12+
* Fixed PHPDoc for some methods.
13+
314
## 1.4.2 (2021-10-01)
415

516
* Fixed `FtpClient::getFileContent` to get the correct file content for binary files ([#20](../../issues/20)).

README.md

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
# Lazzard/FtpClient
22

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)
77

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.
99

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.*
1611

1712
## Installation
1813

1914
The recommended way to install this library is through composer :
2015

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
2916
```
30-
31-
then generate the autoload files :
32-
33-
```console
34-
composer dump-autoload
17+
composer require lazzard/php-ftp-client
3518
```
3619

3720
## Quick Start
@@ -41,32 +24,24 @@ composer dump-autoload
4124

4225
require __DIR__ . '/vendor/autoload.php';
4326

44-
use Lazzard\FtpClient\Connection\FtpConnection;
4527
use Lazzard\FtpClient\Connection\FtpSSLConnection;
4628
use Lazzard\FtpClient\Config\FtpConfig;
4729
use Lazzard\FtpClient\FtpClient;
4830
use Lazzard\FtpClient\Exception\FtpClientException;
4931

5032
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');
5634
$connection->open();
5735

58-
// configure the FTP connection
5936
$config = new FtpConfig($connection);
60-
// set the passive mode on (recommanded)
6137
$config->setPassive(true);
6238

63-
// Start working
6439
$client = new FtpClient($connection);
40+
6541
print_r($client->getFeatures());
66-
67-
// close the connection
42+
6843
$connection->close();
69-
} catch (FtpClientException $ex) { // catch this library exceptions with the 'FtpClientException' exception class
44+
} catch (FtpClientException $ex) {
7045
print_r($ex->getMessage());
7146
}
7247
```
@@ -236,7 +211,7 @@ $client->isFeatureSupported('SIZE');
236211
$client->lastMTime('path/to/file');
237212

238213
// get a content of an FTP file
239-
$client->getFileContent('path/to/file');
214+
$client->getFileContent('path/to/file', FtpWrapper::ASCII);
240215

241216
// get all supported features by the FTP server
242217
$client->getFeatures();
@@ -271,14 +246,19 @@ $client->keepAlive();
271246

272247
## Version Guidance
273248

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.* |
278254

279255
[7]: https://github.com/lazzard/php-ftp-client/releases/tag/v1.0.2
280256
[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!
282262

283263
## License
284264

TODO.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# TODO LIST
22

3+
This document describes some desired features, API methods, and PHP/PHPUnit upgrades for the feature releases of this library.
4+
35
## The next PHP Upgrades
46

5-
- [ ] 7.2v.
6-
- [ ] Create a helper method for the `ftp_append` function.
7-
- [ ] Use `ftp_mlsd` function in `FtpClient::lastMTime` to support directories type.
8-
- [ ] 7.4v.
9-
- [ ] 8.0v.
7+
- [ ] ^7.4 | ^8.0.
108

119
## The next PHPUnit Upgrade
1210

13-
- [ ] PHPUnit 8 (>= PHP 7.2).
1411
- [ ] PHPUnit 9 (>= PHP 7.3).
1512

1613
## API methods
1714

15+
- [ ] Create a helper method for the `ftp_append` function.
1816
- [ ] Add `FtpClient::getTransferMode($file)` method to find the appropriate transfer mode (not based on file extension) for the giving **local** file.
1917
- [ ] Implement a method that allows to download all the files within the giving remote directory.
2018

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lazzard/php-ftp-client",
3-
"description": "A library that wraps the PHP FTP functions in an OOP way.",
3+
"description": "This library provides helper classes and methods to manage your files on the FTP server in an OOP way.",
44
"type": "library",
55
"license": "MIT",
66
"keywords": [
@@ -17,11 +17,11 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=5.6.0",
20+
"php": "^7.2 | 8.0.*",
2121
"ext-ftp": "*"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^5"
24+
"phpunit/phpunit": "^8.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

0 commit comments

Comments
 (0)