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(5y ago)082MITPHPPHP &gt;=7.0

Since Feb 24Pushed 5y 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 today

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

Popularity10

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

1853d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35540165?v=4)[edmur](/maintainers/edmur)[@Edmur](https://github.com/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

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M984](/packages/statamic-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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