Rankings DB is a PHP library to provide a clean interface to interact with the British Swimming rankings database.
Via Composer:
$ composer require huwcbjones/rankings-db *
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
$client = new \RankingsDB\RankingsClient($personal_key, $personal_key_id_number);
From a $client
object, you can fetch member details and times.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
$client = new \RankingsDB\RankingsClient($personal_key, $personal_key_id_number);
// Get a member's details
$member = $client->getMemberDetails($member_id);
// Get their all time PBs
$options = new GetTimesBuilder($member->MemberID());
$times = $client->getTimes($options);
// Get their times from the past year
$options->setFromDate((new DateTime())->sub(new DateInterval("P1Y")));
$times = $client->getTimes($options);
See the doc
directory for more detailed documentation.
rankings-db-php
is licensed under the MIT License - see the LICENSE file for details