PHPackages                             askancy/howlongtobeat - 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. askancy/howlongtobeat

ActiveLibrary[API Development](/categories/api)

askancy/howlongtobeat
=====================

A PHP wrapper to fetch data from howlongtobeat.com with dynamic API key extraction

1.3.1(11mo ago)0145↓50%1MITPHPCI failing

Since Jun 1Pushed 11mo agoCompare

[ Source](https://github.com/Askancy/howlongtobeat)[ Packagist](https://packagist.org/packages/askancy/howlongtobeat)[ Docs](https://github.com/askancy/howlongtobeat)[ RSS](/packages/askancy-howlongtobeat/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

🎮 HowLongToBeat PHP Wrapper
===========================

[](#-howlongtobeat-php-wrapper)

> A modern PHP wrapper to fetch game duration data from [HowLongToBeat.com](https://howlongtobeat.com)
> Perfect for gaming apps, backlog tools, or completionist dashboards.

[ ![Packagist Version](https://camo.githubusercontent.com/7aa4a2c1b3f08007caefe52bbc3d1ee156fae97f044f8c7f040b28527f1a5d3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736b616e63792f686f776c6f6e67746f626561743f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/askancy/howlongtobeat)[ ![Packagist Downloads](https://camo.githubusercontent.com/26c2bc7b9736d0f6c00dfacce9524c3f5a49518c1bac3a758dae6c0bc5a196f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736b616e63792f686f776c6f6e67746f626561743f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/askancy/howlongtobeat)[ ![License](https://camo.githubusercontent.com/7c4d71fe94230343c5482a3807730f059c8dd26d3d5a9e9ddfe4de9184414006/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61736b616e63792f686f776c6f6e67746f626561743f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/askancy/howlongtobeat)

---

✨ Features
----------

[](#-features)

- 🔍 Search games by title
- ⏱ Get main/extra/completionist durations
- 🧩 Fetch rich game details including platforms, stats, and genres
- ⚡ Fully PSR-4, Guzzle-powered, clean and extendable

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require askancy/howlongtobeat
```

---

🚀 Usage
-------

[](#-usage)

### 🔎 Search games

[](#-search-games)

```
use Askancy\HowLongToBeat\HowLongToBeat;

$hl2b = new HowLongToBeat();
$results = $hl2b->search('Lego');
```

Sample response:

```
{
  "Results": [
    {
      "ID": "5265",
      "Title": "LEGO The Lord of the Rings",
      "Image": "https://howlongtobeat.com/gameimages/220px-Lego_Lord_of_the_Rings_cover.jpg",
      "Summary": {
        "Main Story": "10 Hours",
        "Main + Extra": "16 Hours",
        "Completionist": "33 Hours"
      }
    }
  ],
  "Pagination": {
    "Current Page": 1,
    "Last Page": 4
  }
}
```

You can also paginate:

```
$hl2b->search('Lego', 2);
```

---

### 🧠 Get game details by ID

[](#-get-game-details-by-id)

```
$details = $hl2b->get(5265);
```

🚤 Laravel Example
-----------------

[](#-laravel-example)

You can easily integrate this wrapper into a Laravel controller or service class:

**Controller example:**

```
use Askancy\HowLongToBeat\HowLongToBeat;

class GameController extends Controller
{
    public function search(Request $request)
    {
        $query = $request->input('title');
        $hl2b = new HowLongToBeat();
        $results = $hl2b->search($query);

        return view('games.results', ['results' => $results]);
    }

    public function show($id)
    {
        $hl2b = new HowLongToBeat();
        $game = $hl2b->get($id);

        return view('games.show', ['game' => $game]);
    }
}
```

Then route it:

```
Route::get('/games/search', [GameController::class, 'search']);
Route::get('/games/{id}', [GameController::class, 'show']);
```

Includes:

- Full summary and description
- Developer &amp; publisher info
- Platform stats
- Time breakdowns (Main, 100%, Speedrun, Multiplayer, etc.)

---

🤝 Contributing
--------------

[](#-contributing)

Got a bug or an idea?
Open an issue or send a PR — contributions are welcome!

```
git clone https://github.com/askancy/howlongtobeat.git
composer install
vendor/bin/phpunit
```

---

📜 License
---------

[](#-license)

Released under the [MIT License](https://choosealicense.com/licenses/mit/).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance51

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.4% 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 ~0 days

Total

2

Last Release

343d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0774a513bb5b13d7d314c88cbce01726eddb0e4282a0899116ab3ece887ceda6?d=identicon)[Askancy](/maintainers/Askancy)

---

Top Contributors

[![ivankaizer](https://avatars.githubusercontent.com/u/14001131?v=4)](https://github.com/ivankaizer "ivankaizer (58 commits)")[![Askancy](https://avatars.githubusercontent.com/u/789702?v=4)](https://github.com/Askancy "Askancy (15 commits)")[![hechcraft](https://avatars.githubusercontent.com/u/25202564?v=4)](https://github.com/hechcraft "hechcraft (1 commits)")

---

Tags

how long to beathl2bhowlongtobeat

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/askancy-howlongtobeat/health.svg)

```
[![Health](https://phpackages.com/badges/askancy-howlongtobeat/health.svg)](https://phpackages.com/packages/askancy-howlongtobeat)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[sleeping-owl/apist

Package to provide api-like access to foreign sites based on html parsing

3105.3k](/packages/sleeping-owl-apist)[sproutcms/cms

Enterprise content management and framework

241.6k4](/packages/sproutcms-cms)

PHPackages © 2026

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