1.0.3 2014-02-17 10:31 UTC


A simple PHP5 Object Oriented wrapper for GlobalSportsMedia (GSM) XML API.

See http://client.globalsportsmedia.com/documentation


  • Follows PSR-0 conventions and coding standard: autoload friendly
  • API entry points implementation state :
  • OK soccer
  • OK am_football
  • OK aus_football
  • OK baseball
  • OK basketball
  • OK cricket
  • OK golf
  • OK handball
  • OK hockey
  • OK motorsports
  • OK rugby
  • OK tennis
  • OK volleyball


  • PHP >= 5.4 with cURL extension,


Through composer, simply run :

$ php composer.phar require kbsali/gsm-api:1.*

Basic usage of php-gsm-api client

All the methods return a SimpleXmlElement object or throw an Exception in case of error. Following the basic workflow documented in globalsportsmedia.com for working with Soccer data :


// This file is generated by Composer
require_once 'vendor/autoload.php';

$client = new GlobalSportsMedia\Client('http://webpull.globalsportsmedia.com', 'USERNAME', 'PASSWORD');
    ->cacheOn() // for live method (like get_matches_live_updates) you might want to disable caching
    ->setCacheDir(__DIR__.'/cache') // path where xml responess will be cached

try {
    $seasons = $client->api('soccer')->get_seasons(['authorized' => 'yes']);
    foreach ($seasons->competition as $competition) {
        foreach ($competition->season as $season) {
            $matches = $client->api('soccer')
                ->cacheOncePerDay() // cache, but only once a day!
                    (int) $season['season_id'],
                    ['detailed' => 'yes', 'start_date' => date('Y-m-d H:00:00')]
            // process matches...
} catch(\Exception $e) {

You can control if you want to cache the requests to the API (get_seasons() is not likely to change everyday):

  • cacheOff() to never cache the request
  • cacheOn() to cache the request undefinitely (ie. until to clean the cache)
  • cacheOncePerDay() to cache requests for the current day

If you wish to cache the requests you will have to specifiy the cache directory through setCacheDir()