5 1. Getting Started
Jeroen De Meerleer edited this page 2019-09-28 10:23:35 +02:00

Getting started

Installing Libpairtwo

You can easily start using libpairtwo by installing it via composer

$ composer require jeroened/libpairtwo

In you initialization code add the vendor/autoload.php

require_once("vendor/autoload.php");

Reading out a pairing-file

Reading out a pairing-file is very simple. First create a reader. This is simply done by using the IOFactory::createReader() method. Then call the read method of the return value of the IOFactory::createReader() method.

require_once("vendor/autoload.php");
use JeroenED/Libpairtwo/IOFactory;

$filereader = IOFactory::createReader('Swar-4');
$filereader->read('mycompetition.sws');

This will return a usable object for reaching out for results, rankings, etc.

Getting methods of the class

I didn't want to add the generated phpdoc in this library simply because it is generated.

The command to generate it yourself is just $ make api. This will generate the docs in the doc/api folder.

Examples

You can find several examples section a. of this wiki. Below is an aggregation of the pages.

  1. Showing a ranking
  2. Showing the pairings of a specific round
  3. Showing the pairings of a specific player