项目作者: astronati

项目描述 :
Allows to map responses provided by the Soccer - Sports Open Data API
高级语言: PHP
项目地址: git://github.com/astronati/php-sports-open-data-response-parser.git
创建时间: 2018-02-09T15:00:44Z
项目社区:https://github.com/astronati/php-sports-open-data-response-parser

开源协议:MIT License

下载


Build Status
Codacy Badge
Codacy Badge
Latest Stable Version
License

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:

  1. $ 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:

  1. use SODRP\Response\ResponseParser;
  2. ...
  3. // Obtain a Response
  4. $apiResponse = ... // Save this the response from the Sports Open Data API
  5. $response = ResponseParser::create($apiResponse, ResponseParser::GET_SEASONS_AVAILABLE);
  6. ...
  7. // Get 2017-2018 season
  8. $season = $response->findOneBySlug('17-18');
  9. 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:

  1. $ composer install

Testing

Tests files are created in dedicates folders that replicate the
src structure as follows:

  1. .
  2. +-- src
  3. | +-- [folder-name]
  4. | | +-- [file-name].php
  5. | ...
  6. +-- tests
  7. | +-- [folder-name]
  8. | | +-- [file-name]Test.php

Execute following command to run the tests suite:

  1. $ composer test

Run what follows to see the code coverage:

  1. $ composer coverage

License

This package is released under the MIT license.