astronati / world-cups-data-response-parser
Allows to map responses provided by the World Cups Data Data API (stroccoli).
Package info
github.com/astronati/php-world-cups-data-response-parser
pkg:composer/astronati/world-cups-data-response-parser
Requires
- php: >=7.1.0
- astronati/world-cups-data-response-parser: ^1.0
Requires (Dev)
- codacy/coverage: ^1.4
- phpstan/phpstan: ^0.9.1
- phpunit/php-code-coverage: ^5.3
- phpunit/phpunit: ^6.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
World Cups Data Response Parser (Stoccoli)
Allows to map responses provided by the World Cups Data API.
Installation
You can install the library and its dependencies using composer running:
$ composer require astronati/world-cups-data-response-parser
Usage
The library allows to return a model per each response and its content (round, match, team, etc...).
Example
The following snippet can be helpful:
use WCDRP\Response\ResponseParser; ... // Obtain a Response $apiResponse = ... // Save this the response from the World Cups Data API $response = ResponseParser::create($apiResponse); ... // Get first round $round = $response->getRounds()[0]; echo $round->getNumber(); // 1...
For more details please take a look at Response.
Development
The environment requires phpunit, that has been already included in the dev-dependencies of the
composer.json.
Dependencies
To install all modules you just need to run following command:
$ composer install
Testing
Tests files are created in dedicates folders that replicate the src structure as follows:
.
+-- src
| +-- [folder-name]
| | +-- [file-name].php
| ...
+-- tests
| +-- [folder-name]
| | +-- [file-name]Test.php
Execute following command to run the tests suite:
$ composer test
Run what follows to see the code coverage:
$ composer coverage
License
This package is released under the MIT license.