Skip to content

Commit

Permalink
Upgrade php support (#25)
Browse files Browse the repository at this point in the history
*  Update PHP support
*  Update PHPUnit support
  • Loading branch information
jabranr authored Mar 4, 2019
1 parent 0fc71b1 commit 2ae17ff
Show file tree
Hide file tree
Showing 18 changed files with 2,126 additions and 800 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
composer.lock
tests
vendor
*.php-e
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ language: php
sudo: false

php:
- 5.6
- 5.5
- 5.4
- 5.3
- 7.2
- 7.1
- 7.0
- hhvm

before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
- composer install --prefer-source --no-interaction
- chmod +x prepare-tests.sh
- ./prepare-tests.sh

script: phpunit
script: composer run tests
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

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

> Namespaces were added in v2.0.2 so make sure you update your code before migrating from an older version.
#### Migration from v2 to v3

PHP support updated to 7+

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

{
"require": {
"jabranr/csv-parser": "~2.1.*"
"jabranr/csv-parser": "^3.0"
}
}
```
Expand All @@ -28,6 +30,23 @@ Initiate a new instance
$csv = new Jabran\CSV_Parser();
```

# Unit tests

If you have `composer` installed globally then:

Run unit tests
```shell
$ cd path/to/csv-parser
$ composer run tests
```

If you have `phpunit` installed globally then:

```shell
$ cd path/to/csv-parser
$ phpunit
```

# API

Get data from a string
Expand All @@ -36,24 +55,12 @@ Get data from a string
$csv->fromString($str);
```

Get data from a stream (Will be deprecated in future)
```php
/* @param: resource $stream (f.e. php://input) */
$csv->fromStream($stream);
```

Get data from a resource (Since v2.0.2)
```php
/* @param: resource $resource (f.e. resource created using fopen()) */
$csv->fromResource($resource);
```

Get data from a file path (Will be deprecated in future)
```php
/* @param: string $file */
$csv->fromFile($file);
```

Get data from a path/URL (Since v2.0.2)
```php
/* @param: string $path */
Expand Down Expand Up @@ -154,6 +161,8 @@ Array(
```

# License
© 2015—2017 MIT License - [Jabran Rafique](http://jabran.me)
© 2015 onwards

MIT License - [Jabran Rafique](http://jabran.me)

[![Analytics](https://ga-beacon.appspot.com/UA-50688851-1/csv-parser)](https://github.com/igrigorik/ga-beacon)
65 changes: 36 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
{
"name": "jabranr/csv-parser",
"type": "library",
"version": "2.1.1",
"description": "Parse CSV data from a file, stream or string",
"keywords": ["csv", "php", "parser"],
"homepage": "https://github.com/jabranr/csv-parser",
"license": "MIT License",
"authors": [
{
"name": "Jabran Rafique",
"email": "hello@jabran.me",
"homepage": "http://jabran.me"
}
],
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.7.*"
},
"autoload": {
"psr-4": {
"Jabran\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Jabran\\Tests\\": "test"
}
"name": "jabranr/csv-parser",
"type": "library",
"version": "3.0.0",
"description": "Parse CSV data from a file, stream or string",
"keywords": [
"csv",
"php",
"parser"
],
"homepage": "https://github.com/jabranr/csv-parser",
"license": "MIT License",
"authors": [
{
"name": "Jabran Rafique",
"email": "hello@jabran.me",
"homepage": "http://jabran.me"
}
],
"scripts": {
"tests": "phpunit"
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0|^7.0"
},
"autoload": {
"psr-4": {
"Jabran\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Jabran\\Tests\\": "test"
}
}
}
Loading

0 comments on commit 2ae17ff

Please sign in to comment.