Code Monkey home page Code Monkey logo

football-data's Introduction

:FootballData

football-data.org API Container for Laravel 5.1, 5.2

Requirements

  • "guzzlehttp/guzzle": "~6.0"

Install

Via Composer

$ composer require grambas/football-data dev-master

Usage

More about filters, structure and API: football-data.org Documentation

Add your api key to env. file

FootballData_API_KEY=

add to config/app.php

'providers' => [
  Grambas\FootballData\FootballDataServiceProvider::class,
]

'aliases' => [
  'Football' => Grambas\FootballData\Facades\FootballDataFacade::class,
]

Examples

##COMPETITION/LEAGUE
	
/**
 * List all available competitions.
 *
 * @param array $filter ['areas' => 'Integer /[0-9]+/']
 * @return Collection
 */
Football::getLeagues(array $filter = ['areas' => ''])

/**
 * List one particular competition.
 *
 * @param integer $leagueID 
 * @param array $filter ['areas' => 'Integer /[0-9]+/']
 * @return Collection
 */ 
Football::getLeague(int $leagueID, array $filter = ['areas' => ''])

/**
 * List all teams for a particular competition.
 *
 * @param integer $leagueID
 * @param array $filter ['stage' => 'String /[A-Z]+/']
 * @return Collection
 */
Football::getLeagueTeams(int $leagueID, array $filter = ['stage' => ''])

/**
 * Show Standings for a particular competition
 *
 * @param integer $leagueID
 * @return Collection
 */
Football::getLeagueStandings(int $leagueID)

/**
 * List all matches for a particular competition.
 *
 * @param integer $leagueID
 * @param array $filter ['dateFrom' => 'yyyy-MM-dd', 'dateTo' => 'yyyy-MM-dd', 'stage' => 'String /[A-Z]+/', 'status' => 'SCHEDULED | LIVE | IN_PLAY | PAUSED | FINISHED | POSTPONED | SUSPENDED | CANCELED', 'matchday' => 'Integer /[1-4]*[0-9]', 'group' => '']
 * @return Collection
 */
Football::getLeagueMatches(int $leagueID, array $filter = [ 'dateFrom' => '', 'dateTo' => '', 'stage' => '', 'status' => '', 'matchday' => '', 'group' => '' ])
	


##FIXTURES/MATCHES

/**
 * List matches across (a set of) competitions.	
 *
 * @param array $filter [ 'competitions' => 'Integer /[0-9]+/', 'dateFrom' => 'yyyy-MM-dd', 'dateTo' => 'yyyy-MM-dd', 'status' => 'SCHEDULED | LIVE | IN_PLAY | PAUSED | FINISHED | POSTPONED | SUSPENDED | CANCELED' ]
 * @return Collection
 */
Football::getMatches(array $filter = [ 'competitions' => '', 'dateFrom' => '', 'dateTo' => '', 'status' => '' ])

/**
 * Show one particular match.	
 *
 * @param integer $matchID
 * @return Collection
 */
Football::getMatche(int $matchID)



##TEAM

/**
 * Show one particular team.	
 *
 * @param integer $teamID
 * @return Collection
 */
Football::getTeam(int $teamID)

/**
 * Show all matches for a particular team.
 *
 * @param integer $teamID
 * @param array $filter ['dateFrom' => 'yyyy-MM-dd', 'dateTo' => 'yyyy-MM-dd', 'status' => 'SCHEDULED | LIVE | IN_PLAY | PAUSED | FINISHED | POSTPONED | SUSPENDED | CANCELED', 'venue' => 'home|away']
 * @return Collection
 */
Football::getMatchesForTeam(int $teamID, array $filter = [ 'dateFrom' => '', 'dateTo' => '', 'status' => '', 'venue' => '' ])



##AREAS
	
/**
 * List all available areas.
 *
 * @return Collection
 */
Football::getAreas()

/**
 * List one particular area.
 *
 * @param integer $areaID 
 * @return Collection
 */
Football::getArea(int $areaID)

License

The MIT License (MIT). Please see License File for more information.

football-data's People

Contributors

alexssander-cusin avatar grambas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

football-data's Issues

GuzzleHttp\Client

Hi,

sorry - it's me again.

I've installed your package in a fresh Laravel 5.2 installation and tried to call:

Football::getLeagues();

After installing GuzzleHTTP I got the following:

in CurlFactory.php line 186
at CurlFactory::createRejection(object(EasyHandle), array('errno' => '6', 'error' => 'Could not resolve host: http', 'url' => 'http://http:v1/soccerseasons', 'content_type' => null, 'http_code' => '0', 'header_size' => '0', 'request_size' => '0', 'filetime' => '-1', 'ssl_verify_result' => '0', 'redirect_count' => '0', 'total_time' => '0.000232', 'namelookup_time' => '0', 'connect_time' => '0', 'pretransfer_time' => '0', 'size_upload' => '0', 'size_download' => '0', 'speed_download' => '0', 'speed_upload' => '0', 'download_content_length' => '-1', 'upload_content_length' => '-1', 'starttransfer_time' => '0', 'redirect_time' => '0', 'redirect_url' => '', 'primary_ip' => '', 'certinfo' => array(), 'primary_port' => '0', 'local_ip' => '', 'local_port' => '0')) in CurlFactory.php line

It seems there is a problem generating the URL (double http:// instead of the Servername).

Getting Old Data

Hello Team,

Is this project still working? I seem to be getting old data on the API

Latest commit not on composer

I've just installed the package but unfortunately it doesn't have the latest commits and this completely breaks it, leaving random strings in the FootballData.php file:

    public function __construct(Client $client )
    {   
        $this->client = $client;
    }
<<<<<<< HEAD

    //COMPETITION/LEAGUE
    public function LeagueTable($id, $matchday="")
        {
        $leagueTable = $this->client->get("competitions/{$id}/leagueTable/?matchday={$matchday}")->getBody();
        return json_decode($leagueTable);
    }

I can see this was fixed in a commit here: 64cebb4

But when doing composer install or composer update these commits are not included.

Installation Problem

Hi,

if i try to install via composer (composer require grambas/football-data) in a fresh Laravel Instance I've got following Error:

[InvalidArgumentException]
Could not find package grambas/football-data at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

What am I doing wrong?

Logo

There are not all team's logo ? (ex: PSG, Strasbourg...)

Thank You !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.