PHPackages                             loterias-api/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. loterias-api/sdk

ActiveLibrary[API Development](/categories/api)

loterias-api/sdk
================

Official PHP SDK for Loterias API

101[1 PRs](https://github.com/loterias-api/sdk-php/pulls)PHP

Since Jan 15Pushed 5mo agoCompare

[ Source](https://github.com/loterias-api/sdk-php)[ Packagist](https://packagist.org/packages/loterias-api/sdk)[ RSS](/packages/loterias-api-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

loteria-api/sdk
===============

[](#loteria-apisdk)

Official PHP SDK for [Loteria API](https://loteria-api.com).

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Guzzle HTTP client

Installation
------------

[](#installation)

```
composer require loteria-api/sdk
```

Quick Start
-----------

[](#quick-start)

```
use LoteriaApi\LoteriaApi;

$api = new LoteriaApi('lat_xxx...'); // Get your API key at https://loteria-api.com

// Get latest Euromillones result
$result = $api->results->getLatest('euromillones');
print_r($result['data']['combination']); // [4, 15, 23, 38, 42]
print_r($result['data']['resultData']['estrellas']); // [3, 9]
```

Usage Examples
--------------

[](#usage-examples)

### Get Latest Results

[](#get-latest-results)

```
// Latest result for a specific game
$euromillones = $api->results->getLatest('euromillones');
$primitiva = $api->results->getLatest('primitiva');
$bonoloto = $api->results->getLatest('bonoloto');

// Latest results for ALL games
$all = $api->results->getLatestAll();
print_r($all['data']['euromillones']['combination']);
print_r($all['data']['primitiva']['combination']);
```

### Check Your Numbers

[](#check-your-numbers)

```
$result = $api->results->checkNumbers(
    gameType: 'euromillones',
    numbers: [4, 15, 23, 38, 42],
    extraNumbers: [3, 11] // Stars for Euromillones
);

if ($result['data']['isWinner']) {
    echo "You won! Prize: " . $result['data']['prize']['formattedPrize'] . "\n";
    echo "Category: " . $result['data']['prize']['categoryName'] . "\n";
} else {
    echo "No luck. You matched " . $result['data']['mainNumbersMatched'] . " numbers.\n";
}
```

### Query Historical Results

[](#query-historical-results)

```
// Results from a date range
$results = $api->results->getByDateRange(
    gameType: 'euromillones',
    from: '2024-01-01',
    to: '2024-12-31',
    page: 1,
    limit: 10
);

// Results from a specific date
$dateResults = $api->results->getByDate('primitiva', '2024-06-15');

// Filter by minimum jackpot
$bigJackpots = $api->results->listByGame('euromillones', [
    'minJackpot' => 100000000, // 100 million
    'year' => 2024
]);
```

### Get Upcoming Draws

[](#get-upcoming-draws)

```
// All upcoming draws
$upcoming = $api->draws->listUpcoming();

// Next draw for each game
$next = $api->draws->getNextAll();
echo "Next Euromillones: " . $next['data']['euromillones']['drawDate'] . "\n";
echo "Jackpot: " . $next['data']['euromillones']['jackpotFormatted'] . "\n";

// Upcoming draws for a specific game
$euromillonesDraws = $api->draws->listUpcomingByGame('euromillones');
```

Available Game Types
--------------------

[](#available-game-types)

SlugName`bonoloto`Bonoloto`euromillones`Euromillones`primitiva`La Primitiva`gordo`El Gordo`nacional`Loteria Nacional`eurodreams`EuroDreams`quiniela`La Quiniela`quinigol`Quinigol`lototurf`Lototurf`quintuple`Quintuple PlusYou can use string literals or the `GameType` enum:

```
use LoteriaApi\Enums\GameType;

$result = $api->results->getLatest(GameType::EUROMILLONES->value);
// or
$result = $api->results->getLatest('euromillones');
```

Error Handling
--------------

[](#error-handling)

```
use LoteriaApi\LoteriaApi;
use LoteriaApi\Exceptions\LoteriaApiException;

try {
    $result = $api->results->getLatest('euromillones');
} catch (LoteriaApiException $e) {
    echo "API Error: " . $e->getErrorCode() . "\n";
    echo "Message: " . $e->getMessage() . "\n";
    echo "Status: " . $e->getStatusCode() . "\n";

    if ($e->getErrorCode() === 'RATE_LIMIT_EXCEEDED') {
        // Wait and retry
    }
    if ($e->getErrorCode() === 'TOKEN_LIMIT_EXCEEDED') {
        // Upgrade plan or wait for reset
    }
}
```

Configuration
-------------

[](#configuration)

```
$api = new LoteriaApi(
    apiKey: 'lat_xxx...',                              // Required
    baseUrl: 'https://custom.url',                     // Optional (default: https://api.loteria-api.com/api/v1)
    timeout: 60                                        // Optional (default: 30 seconds)
);
```

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance48

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/255016308?v=4)[loterias-api](/maintainers/loterias-api)[@loterias-api](https://github.com/loterias-api)

---

Top Contributors

[![rchernando](https://avatars.githubusercontent.com/u/72400818?v=4)](https://github.com/rchernando "rchernando (1 commits)")

### Embed Badge

![Health badge](/badges/loterias-api-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/loterias-api-sdk/health.svg)](https://phpackages.com/packages/loterias-api-sdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
