PHPackages                             aneeskhan47/php-howlongtobeat-api - 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. aneeskhan47/php-howlongtobeat-api

ActiveLibrary[API Development](/categories/api)

aneeskhan47/php-howlongtobeat-api
=================================

A PHP API wrapper for HowLongToBeat.com

v1.0.3(11mo ago)51031MITPHPPHP ^7.4 || ^8.0CI passing

Since Jan 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/aneeskhan47/php-howlongtobeat-api)[ Packagist](https://packagist.org/packages/aneeskhan47/php-howlongtobeat-api)[ Fund](https://www.paypal.com/paypalme/aneeskhan47)[ RSS](/packages/aneeskhan47-php-howlongtobeat-api/feed)WikiDiscussions main Synced 1mo ago

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

 [![PHP HowLongToBeat API](https://camo.githubusercontent.com/815bb7bfd42fd70420cc28748eae4a98801680e026e63c405a000325b3d88f04/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f486f774c6f6e67546f426561742532305048502532304150492e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d616e6565736b68616e34372532467068702d686f776c6f6e67746f626561742d617069267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b5048502b4150492b777261707065722b666f722b486f774c6f6e67546f426561742e636f6d266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)](https://camo.githubusercontent.com/815bb7bfd42fd70420cc28748eae4a98801680e026e63c405a000325b3d88f04/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f486f774c6f6e67546f426561742532305048502532304150492e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d616e6565736b68616e34372532467068702d686f776c6f6e67746f626561742d617069267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d412b5048502b4150492b777261707065722b666f722b486f774c6f6e67546f426561742e636f6d266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)

 [![GitHub Workflow Status (master)](https://github.com/aneeskhan47/php-howlongtobeat-api/actions/workflows/tests.yml/badge.svg)](https://github.com/aneeskhan47/php-howlongtobeat-api/actions) [![Total Downloads](https://camo.githubusercontent.com/488749d121ac292a1d8196577accb397dd702b35040cf70e63e4b7238f3565e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e6565736b68616e34372f7068702d686f776c6f6e67746f626561742d617069)](https://packagist.org/packages/aneeskhan47/php-howlongtobeat-api) [![Latest Version](https://camo.githubusercontent.com/c5afee0a0dcbdbf80ea3895b711c96aa5bc36395b736d63c7f4be34fb20d2ba8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e6565736b68616e34372f7068702d686f776c6f6e67746f626561742d617069)](https://packagist.org/packages/aneeskhan47/php-howlongtobeat-api) [![License](https://camo.githubusercontent.com/3d32b3b69512ec25e740d5d1d5d4620210478ff55d0fc5a564651b5f51a64bf2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616e6565736b68616e34372f7068702d686f776c6f6e67746f626561742d617069)](https://packagist.org/packages/aneeskhan47/php-howlongtobeat-api)

A simple PHP API to read data from [HowLongToBeat.com](https://howlongtobeat.com).

It is inspired by [ScrappyCocco - HowLongToBeat-PythonAPI](https://github.com/ScrappyCocco/HowLongToBeat-PythonAPI) Python API.

---

⚡️ Installation
---------------

[](#️-installation)

> **Requires PHP 7.4 or higher**

```
composer require aneeskhan47/php-howlongtobeat-api
```

---

🚀 Usage
-------

[](#-usage)

#### Search for games by title

[](#search-for-games-by-title)

by default, it will return 25 results per page and the first page.

```
require 'vendor/autoload.php';

use AneesKhan47\HowLongToBeat\HowLongToBeat;

$hltb = new HowLongToBeat();

try {
    $results = $hltb->searchByTitle("The Last of Us");

    foreach ($results->games as $game) {
        echo "Game: " . $game->name . "\n";
        echo "Image: " . $game->image_url . "\n";
        echo "Main Story: " . $game->main_story_time . "\n";
        echo "Main + Extra: " . $game->main_extra_time . "\n";
        echo "Completionist: " . $game->completionist_time . "\n";
        echo "------------------------\n";
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

You can also specify the number of results per page. for example, to get second page with 10 results per page, you can do this:

```
$results = $hltb->searchByTitle("The Last of Us", 2, 10);
```

Note: The maximum number of results per allowed is 25. This is by HowLongToBeat.com limitation.

#### Search for a single game by its ID

[](#search-for-a-single-game-by-its-id)

```
$game = $hltb->searchById(26286);

echo "Game: " . $game->name . "\n";
echo "Image: " . $game->image_url . "\n";
echo "Main Story: " . $game->main_story_time . "\n";
echo "Main + Extra: " . $game->main_extra_time . "\n";
echo "Completionist: " . $game->completionist_time . "\n";
echo "------------------------\n";
```

---

🔒 Security
----------

[](#-security)

If you discover any security-related issues, please email  instead of using the issue tracker.

---

🙌 Credits
---------

[](#-credits)

- [Anees Khan](https://github.com/aneeskhan47)
- [All Contributors](../../contributors)

---

📜 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance51

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~42 days

Total

4

Last Release

343d ago

### Community

Maintainers

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

---

Top Contributors

[![aneeskhan47](https://avatars.githubusercontent.com/u/30714223?v=4)](https://github.com/aneeskhan47 "aneeskhan47 (17 commits)")

---

Tags

howlongtobeathowlongtobeat-apiphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aneeskhan47-php-howlongtobeat-api/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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