PHP library for parsing Swiss Lotto and Euro Millions results from Swisslos.
composer require mhauri/lotto-parser
To get the latest results from Swiss Lotto
<?php
use LottoParser\Client\SiwssLotto
$lotto = new SwissLotto();
$data = $lotto->current()->get();
// to Array
$data = $lotto->current()->toArray();
// to JSON
$data = $lotto->current()->toJson();
To get the results from a specific date
<?php
use Carbon\Carbon;
use LottoParser\Client\SiwssLotto
$lotto = new SwissLotto();
$date = Carbon::create(2021,02,13);
$data = $lotto->byDate($date)->get();
// to Array
$data = $lotto->byDate($date)->toArray();
// to JSON
$data = $lotto->byDate($date)->toJson();
The same applies for Euro Millions, just replace $lotto = new SwissLotto()
with
$lotto = new EuroMillions();
If you have any issues with this library, open an issue on GitHub.
Any contribution is highly appreciated. The best way to contribute code is to open a pull request on GitHub.
Marcel Hauri, and all other contributors