astronati / sports-open-data-response-parser
Allows to map responses provided by the Sports Open Data API.
Installs: 2 010
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1.0
Requires (Dev)
- codacy/coverage: ^1.4
- consolidation/robo: ~1
- phpstan/phpstan: ^0.9.1
- phpunit/php-code-coverage: ^5.3
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-10-29 05:28:24 UTC
README
Sports Open Data Response Parser
Allows to map responses provided by the Sports Open Data API.
Supported Responses
Not all responses are currently supported but we are happy to work for you if you need some of them.
NOTE: To add another response into the supported list, please file a new issue.
To do that please file a new issue.
Installation
You can install the library and its dependencies using composer
running:
$ composer require astronati/sports-open-data-response-parser
Usage
The library allows to return a model per each response and its content (season, round, match, etc...).
Example
The following snippet can be helpful:
use SODRP\Response\ResponseParser; ... // Obtain a Response $apiResponse = ... // Save this the response from the Sports Open Data API $response = ResponseParser::create($apiResponse, ResponseParser::GET_SEASONS_AVAILABLE); ... // Get 2017-2018 season $season = $response->findOneBySlug('17-18'); echo $season->getStartDate(); // 2017-07-01...
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.