PHPackages                             zenkilies/igdb-laravel - 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. zenkilies/igdb-laravel

ActiveLibrary[API Development](/categories/api)

zenkilies/igdb-laravel
======================

A Laravel Wrapper for the IGDB API v3

1.0.2(6y ago)010MITPHPPHP ^7.2.5

Since Jan 10Pushed 6y agoCompare

[ Source](https://github.com/zenkilies/igdb-laravel)[ Packagist](https://packagist.org/packages/zenkilies/igdb-laravel)[ RSS](/packages/zenkilies-igdb-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (22)Used By (0)

IGDB Laravel Wrapper
====================

[](#igdb-laravel-wrapper)

This is a Laravel-Wrapper for version 3 of the [IGDB API](https://api.igdb.com/) (Apicalypse).

Basic installation
------------------

[](#basic-installation)

You can install this package via composer using:

```
composer require marcreichel/igdb-laravel
```

The package will automatically register its service provider.

To publish the config file to `config/igdb.php` run:

```
php artisan vendor:publish --provider="MarcReichel\IGDBLaravel\IGDBLaravelServiceProvider"
```

This is the default content of the config file:

```
return [
    /*
     * This is the API Token you got from https://api.igdb.com
     */
    'api_token' => env('IGDB_TOKEN', ''),

    /*
     * This package caches queries automatically (for 1 hour per default).
     * Here you can set how long each query should be cached (in seconds).
     *
     * To turn cache off set this value to 0
     */
    'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),

    /*
     * This is the per-page limit for your tier.
     */
    'per_page_limit' => 500,

    /*
     * This is the offset limit for your tier.
     */
    'offset_limit' => 5000,
];
```

Usage
-----

[](#usage)

If you're familiar with the [Eloquent System](https://laravel.com/docs/master/eloquent)and the [Query Builder](https://laravel.com/docs/master/queries) of Laravel you will love this package as it uses a similar approach.

### Models

[](#models)

Each endpoint of the API is mapped to its own model.

To get a list of games you simply call something like this:

```
use MarcReichel\IGDBLaravel\Models\Game;

$games = Game::where('first_release_date', '>=', 1546297200)->get();
```

Here's a list of all available Models:

- Achievement
- AchievementIcon
- AgeRating
- AgeRatingContentDescription
- AlternativeName
- Artwork
- Character
- CharacterMugShot
- Collection
- Company
- CompanyLogo
- CompanyWebsite
- Cover
- ExternalGame
- Feed
- Franchise
- Game
- GameEngine
- GameEngineLogo
- GameMode
- GameVersion
- GameVersionFeature
- GameVersionFeatureValue
- GameVideo
- Genre
- InvolvedCompany
- Keyword
- MultiplayerMode
- Page
- PageBackground
- PageLogo
- PageWebsite
- Platform
- PlatformLogo
- PlatformVersion
- PlatformVersionCompany
- PlatformVersionReleaseDate
- PlatformWebsite
- PlayerPerspective
- ProductFamily
- Pulse
- PulseGroup
- PulseSource
- PulseUrl
- ReleaseDate
- Screenshot
- Search
- Theme
- TimeToBeat
- Title
- Website

### Query Builder

[](#query-builder)

You can use one of the defined models listed above. The search results will be mapped into the used model automatically then. This method is used in the examples below.

Otherwise you can use the Query Builder itself like this:

```
use MarcReichel\IGDBLaravel\Builder as IGDB;

$igdb = new IGDB('games'); // 'games' is the endpoint

$games = $igdb->get();
```

#### Select

[](#select)

Select which fields should be in the response. If you want to have all available fields in the response you can also skip this method as the query builder will select `*` by default. (**Attention**: This is the opposite behaviour from the Apicalypse API)

```
$games = Game::select(['*'])->get();

$games = Game::select(['name', 'first_release_date'])->get();
```

#### Search

[](#search)

```
$games = Game::search('Fortnite')->get();
```

#### Where-Clauses

[](#where-clauses)

##### Simple Where Clauses

[](#simple-where-clauses)

```
$games = Game::where('first_release_date', '>=', 1546297200)->get();
```

For convenience, if you want to verify that a column is equal to a given value, you may pass the value directly as the second argument to the `where` method:

```
$games = Game::where('name', 'Fortnite')->get();
```

##### Or Statements

[](#or-statements)

You may chain where constraints together as well as add `or` clauses to the query. The `orWhere` method accepts the same arguments as the `where` method:

```
$games = Game::where('name', 'Fortnite')->orWhere('name', 'Borderlands 2')->get();
```

##### Additional Where Clauses

[](#additional-where-clauses)

###### whereBetween

[](#wherebetween)

The `whereBetween` method verifies that a fields's value is between two values:

```
$games = Game::whereBetween('first_release_date', 1546297200, 1577833199)->get();
```

###### whereNotBetween

[](#wherenotbetween)

The `whereNotBetween` method verifies that a field's value lies outside of two values:

```
$games = Game::whereNotBetween('first_release_date', 1546297200, 1577833199)->get();
```

###### whereIn

[](#wherein)

The `whereIn` method verifies that a given field's value is contained within the given array:

```
$games = Game::whereIn('category', [0,4])->get();
```

###### whereNotIn

[](#wherenotin)

The `whereNotIn` method verifies that the given field's value is **not**contained in the given array:

```
$games = Game::whereNotIn('category', [0,4])->get();
```

###### whereInAll / whereNotInAll / whereInExact / whereNotInExact

[](#whereinall--wherenotinall--whereinexact--wherenotinexact)

Alternatively you could use one of these methods to match against **all** or **exactly** the given array.

###### whereNull

[](#wherenull)

The `whereNull` method verifies that the value of the given field is `NULL`:

```
$games = Game::whereNull('first_release_date')->get();
```

###### whereNotNull

[](#wherenotnull)

The `whereNotNull` method verifies that the field's value is **not** `NULL`:

```
$games = Game::whereNotNull('first_release_date')->get();
```

###### whereDate

[](#wheredate)

The `whereDate` method may be used to compare a field's value against a date:

```
$games = Game::whereDate('first_release_date', '2019-01-01')->get();
```

###### whereYear

[](#whereyear)

The `whereYear` method may be used to compare a fields's value against a specific year:

```
$games = Game::whereYear('first_release_date', 2019)->get();
```

###### whereHas / whereHasNot

[](#wherehas--wherehasnot)

These methods have the same syntax as `whereNull` and `whereNotNull` and literally do the exact same thing.

##### Parameter Grouping

[](#parameter-grouping)

```
$games = Game::where('name', 'Fortnite')
    ->orWhere(function($query) {
        $query->where('aggregated_rating', '>=', 90)
            ->where('aggregated_rating_count', '>=', 3000);
    })->get();
```

#### Ordering, Limit, &amp; Offset

[](#ordering-limit--offset)

##### orderBy

[](#orderby)

The `orderBy` method allows you to sort the result of the query by a given field. The first argument to the `orderBy` method should be the field you wish to sort by, while the second argument controls the direction of the sort and may be either `asc` or `desc`:

```
$games = Game::orderBy('first_release_date', 'asc')->get();
```

##### skip / take

[](#skip--take)

To limit the number of results returned from the query, or to skip a given number of results in the query, you may use the `skip` and `take` methods (Both methods are limited to your current tier, so make sure you configure them correctly in the config file):

```
$games = Game::skip(10)->take(5)->get();
```

Alternatively, you may use the `limit` and `offset` methods:

```
$games = Game::offset(10)->limit(5)->get();
```

#### Cache

[](#cache)

You can overwrite the default cache time for one specific query. So you can for example turn off caching for a query:

```
$games = Game::cache(0)->get();
```

#### Get

[](#get)

To finally get results for the query, simply call `get`:

```
$games = Game::get();
```

#### All

[](#all)

If you just want to get "all" results (limited to the per\_page\_limit of your tier) just call the `all`-Method directly on your model:

```
$games = Game::all();
```

#### First

[](#first)

If you only want one result call the `first`-method after your query:

```
$game = Game::first();
```

#### Find

[](#find)

If you know the Identifier of the model you can simply call the `find`-method with the identifier as a parameter:

```
$game = Game::find(1905);
```

##### FindOrFail

[](#findorfail)

`find` returns `null` if no result were found. If you want to throw an Exception instead use `findOrFail`. This will throw an `MarcReichel\IGDBLaravel\Exceptions\ModelNotFoundException` if no result were found.

#### Relationships (Extends)

[](#relationships-extends)

To extend your result use the `with`-method:

```
$game = Game::with(['cover', 'artworks'])->get();
```

By default, every field (`*`) of the relationship is selected. If you want to define the fields of the relationship yourself you have to define the relationship as the array-key and the fields as an array:

```
$game = Game::with(['cover' => ['url', 'image_id'])->get();
```

### Reading properties

[](#reading-properties)

#### Model-based approach

[](#model-based-approach)

If you used the Model-based approach you can simply get a property:

```
$game = Game::find(1905);

if ($game) {
    echo $game->name; // Will output "Fortnite"
}
```

If you want to access a property which does not exist `null` is returned:

```
$game = Game::find(1905);

if ($game) {
    echo $game->foo; // Will output nothing
}
```

#### Query-Builder-based approach

[](#query-builder-based-approach)

If you used the Query Builder itself you must check if a property exists yourself.

TODO List
---------

[](#todo-list)

- Refactor code (beautify code)
- Write unit tests

Contribution
------------

[](#contribution)

Pull requests are welcome :)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 60.5% 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.

###  Release Activity

Cadence

Every ~23 days

Recently: every ~50 days

Total

21

Last Release

2217d ago

Major Versions

v0.10.2 → 1.0.02019-12-31

PHP version history (3 changes)v0.1.0PHP ^7.1.3

v0.10.0PHP ^7.2

1.0.1PHP ^7.2.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3625808542236e63bcc0839534a64600d4ca425242b7631313dd26d029c1357?d=identicon)[zenkilies](/maintainers/zenkilies)

---

Top Contributors

[![marcreichel](https://avatars.githubusercontent.com/u/7645035?v=4)](https://github.com/marcreichel "marcreichel (23 commits)")[![Andrew-Shook](https://avatars.githubusercontent.com/u/2798090?v=4)](https://github.com/Andrew-Shook "Andrew-Shook (5 commits)")[![lofonic](https://avatars.githubusercontent.com/u/32524287?v=4)](https://github.com/lofonic "lofonic (3 commits)")[![JanderV](https://avatars.githubusercontent.com/u/2125363?v=4)](https://github.com/JanderV "JanderV (3 commits)")[![dominik-wbz](https://avatars.githubusercontent.com/u/8103258?v=4)](https://github.com/dominik-wbz "dominik-wbz (2 commits)")[![mydnic](https://avatars.githubusercontent.com/u/2733767?v=4)](https://github.com/mydnic "mydnic (1 commits)")[![zenkilies](https://avatars.githubusercontent.com/u/7152308?v=4)](https://github.com/zenkilies "zenkilies (1 commits)")

---

Tags

laravelwrapperApi Wrapperigdbapicalypseigdb-api

### Embed Badge

![Health badge](/badges/zenkilies-igdb-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/zenkilies-igdb-laravel/health.svg)](https://phpackages.com/packages/zenkilies-igdb-laravel)
```

###  Alternatives

[marcreichel/igdb-laravel

A Laravel wrapper for version 4 of the IGDB API (Apicalypse) including webhook handling

115146.6k1](/packages/marcreichel-igdb-laravel)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[fiveam-code/laravel-notion-api

Laravel Wrapper for the Notion API

435224.4k1](/packages/fiveam-code-laravel-notion-api)[nickurt/laravel-postcodeapi

Universal PostcodeApi for Laravel 11.x/12.x/13.x

97221.2k](/packages/nickurt-laravel-postcodeapi)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

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