Giter Site home page Giter Site logo

php-knkv-webservice-api's Introduction

KNKV Webservice API Wrapper

Use Composer to install this package ("fruitcakestudio/knkv-webservice-api": "0.1.x@dev",) and require the autoloader.

You can use the HttpClient to make requests to the API directly or use the API object to get more abstracted results.

All objects have public properties, matching the key/value from the API directly. getProgam, getResults and getStandings can be called on the API directly, or on a team. The Team ID is then passed on automatically.

See the documentation on http://www.onswebbond.nl/userfiles/knkv/webservice.zip

You need a subscription to the Onsweb Clubplugin for KNKV: http://www.onswebbond.nl/

Note: the API limits unique requests to 1 per hour. See Cache usage below.

Note: the page parameter on getResults doesn't seem to be working yet.

Simple example:

require_once __DIR__ .'/../vendor/autoload.php';

use KNKV\Webservice\Api;

// Create a new API instance
$api = new Api($code);

$program = $api->getProgram(true);

foreach($api->getTeams() as $team){
    echo $team->getName();
    $results = $team->getResults();

    foreach($team->getStandings() as $standing){
        echo $standing->poule->getName();
        foreach ($standing->lines as $line) {
            echo $line->position .'. ' . $line->team_name;
        }
    }
}

Cache

You can use the cache component from Laravel (illuminate/cache). By default, an ArrayCache is used, which only caches for the current request. If you want to use a FileCache for example, composer require "illuminate/filesystem": "~4.0 and do the following:

$filesystem = new \Illuminate\Filesystem\Filesystem;
$cacheStore = new \Illuminate\Cache\FileStore($filesystem, __DIR__.'/cache');

// Create a new API instance
$api = new Api($code, $cacheStore);

When using Laravel, you can use Cache::getStore() to get the Cache store.

php-knkv-webservice-api's People

Contributors

barryvdh avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

swiped

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.