承接 kbsali/gsm-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kbsali/gsm-api

Composer 安装命令:

composer require kbsali/gsm-api

包简介

GlobalSportsMedia (GSM) API client

README 文档

README

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

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

Features

  • 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

Requirements

  • PHP >= 5.4 with cURL extension,

Install

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 :

<?php

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

$client = new GlobalSportsMedia\Client('http://webpull.globalsportsmedia.com', 'USERNAME', 'PASSWORD');
$client
    ->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!
                ->get_matches(
                    (int) $season['season_id'],
                    'season',
                    ['detailed' => 'yes', 'start_date' => date('Y-m-d H:00:00')]
                )
            ;
            // process matches...
        }
    }
} catch(\Exception $e) {
    die($e->getMessage());
}

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()

统计信息

  • 总下载量: 661
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固