Skip to content

Commit 2ae17ff

Browse files
authored
Upgrade php support (#25)
* Update PHP support * Update PHPUnit support
1 parent 0fc71b1 commit 2ae17ff

18 files changed

+2126
-800
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.DS_Store
2-
composer.lock
32
tests
43
vendor
4+
*.php-e

.travis.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ language: php
22
sudo: false
33

44
php:
5-
- 5.6
6-
- 5.5
7-
- 5.4
8-
- 5.3
5+
- 7.2
6+
- 7.1
97
- 7.0
10-
- hhvm
118

129
before_script:
1310
- composer self-update
14-
- composer install --prefer-source --no-interaction --dev
11+
- composer install --prefer-source --no-interaction
12+
- chmod +x prepare-tests.sh
13+
- ./prepare-tests.sh
1514

16-
script: phpunit
15+
script: composer run tests

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
PHP client to parse CSV data from a path, file, stream, resource or string into indexed or associative arrays.
44

5-
> Namespaces were added in v2.0.2 so make sure you update your code before migrating from an older version.
5+
#### Migration from v2 to v3
6+
7+
PHP support updated to 7+
68

79
# Install
810
Install using [composer](http://getcomposer.org)
@@ -12,7 +14,7 @@ Install using [composer](http://getcomposer.org)
1214

1315
{
1416
"require": {
15-
"jabranr/csv-parser": "~2.1.*"
17+
"jabranr/csv-parser": "^3.0"
1618
}
1719
}
1820
```
@@ -28,6 +30,23 @@ Initiate a new instance
2830
$csv = new Jabran\CSV_Parser();
2931
```
3032

33+
# Unit tests
34+
35+
If you have `composer` installed globally then:
36+
37+
Run unit tests
38+
```shell
39+
$ cd path/to/csv-parser
40+
$ composer run tests
41+
```
42+
43+
If you have `phpunit` installed globally then:
44+
45+
```shell
46+
$ cd path/to/csv-parser
47+
$ phpunit
48+
```
49+
3150
# API
3251

3352
Get data from a string
@@ -36,24 +55,12 @@ Get data from a string
3655
$csv->fromString($str);
3756
```
3857

39-
Get data from a stream (Will be deprecated in future)
40-
```php
41-
/* @param: resource $stream (f.e. php://input) */
42-
$csv->fromStream($stream);
43-
```
44-
4558
Get data from a resource (Since v2.0.2)
4659
```php
4760
/* @param: resource $resource (f.e. resource created using fopen()) */
4861
$csv->fromResource($resource);
4962
```
5063

51-
Get data from a file path (Will be deprecated in future)
52-
```php
53-
/* @param: string $file */
54-
$csv->fromFile($file);
55-
```
56-
5764
Get data from a path/URL (Since v2.0.2)
5865
```php
5966
/* @param: string $path */
@@ -154,6 +161,8 @@ Array(
154161
```
155162

156163
# License
157-
© 2015—2017 MIT License - [Jabran Rafique](http://jabran.me)
164+
© 2015 onwards
165+
166+
MIT License - [Jabran Rafique](http://jabran.me)
158167

159168
[![Analytics](https://ga-beacon.appspot.com/UA-50688851-1/csv-parser)](https://github.com/igrigorik/ga-beacon)

composer.json

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
{
2-
"name": "jabranr/csv-parser",
3-
"type": "library",
4-
"version": "2.1.1",
5-
"description": "Parse CSV data from a file, stream or string",
6-
"keywords": ["csv", "php", "parser"],
7-
"homepage": "https://github.com/jabranr/csv-parser",
8-
"license": "MIT License",
9-
"authors": [
10-
{
11-
"name": "Jabran Rafique",
12-
"email": "hello@jabran.me",
13-
"homepage": "http://jabran.me"
14-
}
15-
],
16-
"require": {
17-
"php": ">=5.3.0"
18-
},
19-
"require-dev": {
20-
"phpunit/phpunit": "4.7.*"
21-
},
22-
"autoload": {
23-
"psr-4": {
24-
"Jabran\\": "src"
25-
}
26-
},
27-
"autoload-dev": {
28-
"psr-4": {
29-
"Jabran\\Tests\\": "test"
30-
}
2+
"name": "jabranr/csv-parser",
3+
"type": "library",
4+
"version": "3.0.0",
5+
"description": "Parse CSV data from a file, stream or string",
6+
"keywords": [
7+
"csv",
8+
"php",
9+
"parser"
10+
],
11+
"homepage": "https://github.com/jabranr/csv-parser",
12+
"license": "MIT License",
13+
"authors": [
14+
{
15+
"name": "Jabran Rafique",
16+
"email": "hello@jabran.me",
17+
"homepage": "http://jabran.me"
3118
}
19+
],
20+
"scripts": {
21+
"tests": "phpunit"
22+
},
23+
"require": {
24+
"php": ">=7.0"
25+
},
26+
"require-dev": {
27+
"phpunit/phpunit": "^6.0|^7.0"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"Jabran\\": "src"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"Jabran\\Tests\\": "test"
37+
}
38+
}
3239
}

0 commit comments

Comments
 (0)