PHPackages                             rumd3x/nightbot-api-lib - 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. rumd3x/nightbot-api-lib

ActiveLibrary[API Development](/categories/api)

rumd3x/nightbot-api-lib
=======================

A PHP wrapper for Nightbot's Web API.

0.2.0(4y ago)079MITPHPPHP &gt;=7.0

Since Feb 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rumd3x/nightbot-api-lib)[ Packagist](https://packagist.org/packages/rumd3x/nightbot-api-lib)[ Docs](https://github.com/rumd3x/nightbot-api-lib)[ RSS](/packages/rumd3x-nightbot-api-lib/feed)WikiDiscussions main Synced 1mo ago

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

nightbot-api-lib
================

[](#nightbot-api-lib)

A PHP wrapper for Nightbot's Web API.

Install
-------

[](#install)

```
composer require rumd3x/nightbot-api-lib
```

Examples
--------

[](#examples)

Authorization Code Flow

```
use Rumd3x\NightbotAPI\NightbotAPI;
use Rumd3x\NightbotAPI\NightbotProvider;

$provider = new NightbotProvider('CLIENT_ID','CLIENT_SECRET','REDIRECT_URL');

if (!isset($_GET['code'])) {

    $options = ['scope' => [
        'channel_send',
    ]];

    header('Location: ' . $provider->getAuthorizationUrl($options));
    die;

} else {

    $accessToken = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code'],
    ]);

    $api = new NightbotAPI($accessToken);
    $me = $api->me();

    print_r($me);

    echo 'Access Token: ' . $accessToken->getToken() . "";
    echo 'Refresh Token: ' . $accessToken->getRefreshToken() . "";
    echo 'Expired in: ' . $accessToken->getExpires() . "";
    echo 'Already expired? ' . ($accessToken->hasExpired() ? 'expired' : 'not expired') . "";

    // Store Refresh Token for Future use.
}
```

Refreshing Tokens

```
    use Rumd3x\NightbotAPI\NightbotAPI;
    use Rumd3x\NightbotAPI\NightbotProvider;

    $provider = new NightbotProvider('CLIENT_ID','CLIENT_SECRET','REDIRECT_URL');

    $refreshToken = getAccessTokenFromYourDataStore();

    $newAccessToken = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $refreshToken,
    ]);

    $api = new NightbotAPI($newAccessToken);
    $api->sendChatMessage('Hello Gamers!');

    echo 'Access Token: ' . $newAccessToken->getToken() . "";
    echo 'Refresh Token: ' . $newAccessToken->getRefreshToken() . "";
    echo 'Expired in: ' . $newAccessToken->getExpires() . "";
    echo 'Already expired? ' . ($newAccessToken->hasExpired() ? 'expired' : 'not expired') . "";

    // Store New Refresh Token for Future use.
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~51 days

Total

3

Last Release

1806d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a9bb5384975b87cebcef2b7642e2b5b3b79d0a3be614fdcbbe008f5b6ca3c08?d=identicon)[edmur](/maintainers/edmur)

---

Top Contributors

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

---

Tags

nightbot

### Embed Badge

![Health badge](/badges/rumd3x-nightbot-api-lib/health.svg)

```
[![Health](https://phpackages.com/badges/rumd3x-nightbot-api-lib/health.svg)](https://phpackages.com/packages/rumd3x-nightbot-api-lib)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[atymic/twitter

Twitter API for PHP &amp; Laravel

945555.4k2](/packages/atymic-twitter)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)

PHPackages © 2026

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