PHPackages                             fof/github-sponsors - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fof/github-sponsors

ActiveFlarum-extension[Utility &amp; Helpers](/categories/utility)

fof/github-sponsors
===================

GitHub Sponsors integration for your Flarum forum

1.2.0(4mo ago)266511MITPHPCI passing

Since Dec 14Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/FriendsOfFlarum/github-sponsors)[ Packagist](https://packagist.org/packages/fof/github-sponsors)[ Docs](https://friendsofflarum.org)[ Fund](https://opencollective.com/fof/donate)[ RSS](/packages/fof-github-sponsors/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (12)Used By (1)

GitHub Sponsors by FriendsOfFlarum
==================================

[](#github-sponsors-by-friendsofflarum)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/0129f1de39b3dae3666c369b2af81d9b4e8b7b56f22df7575114c86dd93bc313/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f662f6769746875622d73706f6e736f72732e737667)](https://packagist.org/packages/fof/github-sponsors) [![OpenCollective](https://camo.githubusercontent.com/1903c197bb0307e60d6328653532b8a6b9890b898fbc92e314ab39d699491e74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e636f6c6c6563746976652d666f662d626c75652e737667)](https://opencollective.com/fof/donate) [![Donate](https://camo.githubusercontent.com/6c7b26396e320eb8dd60d767a4500684b60bb7d37f7cacbaf6b2eae6f2d30010/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d6461746974697365762d696d706f7274616e742e737667)](https://datitisev.me/donate)

A [Flarum](http://flarum.org) extension that automatically synchronizes your GitHub Sponsors with Flarum user groups.

Features
--------

[](#features)

- 🔄 **Automatic Synchronization**: Hourly checks for new and removed sponsors
- 👥 **Smart User Matching**: Matches sponsors via email and GitHub OAuth login
- 🎯 **Flexible Configuration**: Works with both user and organization sponsor accounts
- 🔒 **Safe Group Management**: Only manages users it adds, won't interfere with manually assigned groups
- 📝 **Detailed Logging**: Tracks all changes in dedicated log files

How It Works
------------

[](#how-it-works)

This extension connects your GitHub Sponsors program with your Flarum forum by:

1. **Fetching Sponsors**: Queries GitHub's GraphQL API to retrieve your current sponsors
2. **Matching Users**: Identifies Flarum users by matching:
    - Email addresses from GitHub sponsors with Flarum user emails
    - GitHub OAuth provider IDs for users who logged in via GitHub
3. **Managing Groups**: Automatically adds sponsors to a designated Flarum group and removes users who are no longer sponsors
4. **Tracking Changes**: Logs all additions and removals to help you monitor the process

Installation
------------

[](#installation)

Install with composer:

```
composer require fof/github-sponsors:"*"
php flarum migrate
php flarum cache:clear
```

### Required: Flarum Scheduler

[](#required-flarum-scheduler)

This extension requires [Flarum's scheduler](https://docs.flarum.org/scheduler/) to be set up and running. The extension will automatically check for sponsor updates every hour.

Configuration
-------------

[](#configuration)

After installation, configure the extension in your Flarum admin panel:

### 1. Create a GitHub Personal Access Token

[](#1-create-a-github-personal-access-token)

1. Go to [GitHub Settings &gt; Tokens](https://github.com/settings/tokens)
2. Click "Generate new token (classic)"
3. Give it a descriptive name (e.g., "Flarum Sponsors Sync")
4. Select the following scopes:
    - `read:user` - Read user profile data
    - `user:email` - Read the user email address
    - `read:org` - Read organization membership (if syncing an organization)
5. Click "Generate token" and copy it

### 2. Configure the Extension

[](#2-configure-the-extension)

In your Flarum admin panel, navigate to the GitHub Sponsors extension settings:

- **API Token**: Paste your GitHub personal access token
- **Account Type**: Choose "user" or "organization" depending on your sponsor account type
- **Login**: Enter your GitHub username or organization name
- **Group**: Select which Flarum group to assign to sponsors

Save the settings, and the extension will start syncing on the next scheduled run.

Usage
-----

[](#usage)

Once configured, the extension runs automatically every hour. You can also manually trigger an update:

```
php flarum fof:github-sponsors:update
```

### Command Options

[](#command-options)

#### Dry-Run Mode

[](#dry-run-mode)

Preview what changes would be made without actually applying them:

```
php flarum fof:github-sponsors:update --dry-run
```

This is useful for testing your configuration before letting the extension make real changes to your groups.

#### Verbose Output

[](#verbose-output)

Get detailed information about the synchronization process:

```
php flarum fof:github-sponsors:update -v
```

Verbose mode shows:

- Configuration details (account type, login, target group)
- All sponsors from GitHub with their IDs and emails
- Matched Flarum users with match method (email or GitHub OAuth)
- Unmatched sponsors who couldn't be linked to Flarum accounts
- Summary of users staying, being added, and being removed

Combine both options for detailed preview:

```
php flarum fof:github-sponsors:update --dry-run -v
```

### Viewing Logs

[](#viewing-logs)

Check the synchronization logs:

```
tail -f storage/logs/fof-github-sponsors.log
```

Log output includes:

- Number of sponsors found on GitHub
- Number of sponsors matched to Flarum users
- Users added to the group (with `+ #userID username`)
- Users removed from the group (with `- #userID username`)
- Any API errors or configuration issues

How User Matching Works
-----------------------

[](#how-user-matching-works)

The extension uses two methods to match GitHub sponsors to Flarum users:

1. **Email Matching**: Direct comparison of sponsor email from GitHub with Flarum user emails
2. **OAuth Matching**: For users who logged in via GitHub, matches their GitHub ID with sponsor IDs

This dual approach maximizes the chance of correctly identifying your sponsors.

Important Notes
---------------

[](#important-notes)

- The extension only removes the group from users it previously added. It won't affect users who were manually added to the group.
- Users must have either the same email address as their GitHub account OR have logged into Flarum via GitHub OAuth at least once.
- The GitHub API has rate limits. The extension checks once per hour to stay well within these limits.

For Developers: Event System
----------------------------

[](#for-developers-event-system)

This extension dispatches events when sponsors are added or removed, allowing other extensions to react to these changes.

### Available Events

[](#available-events)

#### `FoF\GitHubSponsors\Event\SponsorAdded`

[](#fofgithubsponsorseventsponsoradded)

Dispatched when a user is added to the sponsors group.

**Properties:**

- `$user` (Flarum\\User\\User) - The Flarum user who was added
- `$sponsorData` (object|null) - GitHub sponsor data including:
    - `email` - Sponsor's email address
    - `databaseId` - GitHub user ID
    - `login` - GitHub username
    - Other fields from the GitHub API

**Example listener:**

```
use Flarum\Extend;
use FoF\GitHubSponsors\Event\SponsorAdded;

return [
    (new Extend\Event)
        ->listen(SponsorAdded::class, function (SponsorAdded $event) {
            $user = $event->user;
            $githubId = $event->sponsorData->databaseId ?? null;

            // Your custom logic here
            // e.g., send a welcome email, grant additional permissions, etc.
        }),
];
```

#### `FoF\GitHubSponsors\Event\SponsorRemoved`

[](#fofgithubsponsorseventsponsorremoved)

Dispatched when a user is removed from the sponsors group (sponsorship ended).

**Properties:**

- `$user` (Flarum\\User\\User) - The Flarum user who was removed

**Example listener:**

```
use Flarum\Extend;
use FoF\GitHubSponsors\Event\SponsorRemoved;

return [
    (new Extend\Event)
        ->listen(SponsorRemoved::class, function (SponsorRemoved $event) {
            $user = $event->user;

            // Your custom logic here
            // e.g., send a thank you message, revoke special access, etc.
        }),
];
```

### Notes on Events

[](#notes-on-events)

- Events are **not dispatched** when running with the `--dry-run` flag
- Events fire after the database changes have been made
- The `SponsorAdded` event includes raw GitHub data for additional context
- These events only fire for automated changes, not manual group assignments

Troubleshooting
---------------

[](#troubleshooting)

### No sponsors are being synced

[](#no-sponsors-are-being-synced)

- Verify your GitHub token has the correct scopes (`user` and `read:org`)
- Check that the account type and login match your GitHub Sponsors account
- Ensure the cron job is running (`schedule:run`)
- Check logs in `storage/logs/fof-github-sponsors.log`

### Some sponsors aren't being matched

[](#some-sponsors-arent-being-matched)

- Ensure sponsors have public email addresses on their GitHub profiles
- Alternatively, have them log into your Flarum forum using GitHub OAuth at least once

Updating
--------

[](#updating)

```
composer update fof/github-sponsors
php flarum migrate
php flarum cache:clear
```

[![OpenCollective](https://camo.githubusercontent.com/8ea53c451470d1a72789d650c77e2b22eee915f7fbf2cbeeeeaa25f47301efe2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d667269656e64736f66666c6172756d2d3434414545353f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e2d636f6c6c656374697665)](https://opencollective.com/fof/donate) [![GitHub](https://camo.githubusercontent.com/19562cc0996a556a7abda08327f57924e288bbbc3c5312b096c62175a2841ae4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d6461746974697365762d6561346161613f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562)](https://datitisev.me/donate/github)

- [Packagist](https://packagist.org/packages/fof/github-sponsors)
- [GitHub](https://github.com/FriendsOfFlarum/github-sponsors)

An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum).

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance79

Regular maintenance activity

Popularity20

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

12

Last Release

92d ago

Major Versions

0.3.0 → 1.0.02021-06-03

1.2.0 → 2.0.0-beta.12025-12-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16573496?v=4)[IanM](/maintainers/imorland)[@imorland](https://github.com/imorland)

![](https://avatars.githubusercontent.com/u/1630413?v=4)[Gregor Hammerschmidt](/maintainers/GreXXL)[@GreXXL](https://github.com/GreXXL)

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

![](https://www.gravatar.com/avatar/1298cdc0b2402a1aa34fb75a254947d655e090d62bd0531311331d369cac934e?d=identicon)[datitisev](/maintainers/datitisev)

---

Top Contributors

[![imorland](https://avatars.githubusercontent.com/u/16573496?v=4)](https://github.com/imorland "imorland (11 commits)")[![flarum-bot](https://avatars.githubusercontent.com/u/39334649?v=4)](https://github.com/flarum-bot "flarum-bot (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![dsevillamartin](https://avatars.githubusercontent.com/u/6401250?v=4)](https://github.com/dsevillamartin "dsevillamartin (4 commits)")[![karaok491](https://avatars.githubusercontent.com/u/72854852?v=4)](https://github.com/karaok491 "karaok491 (3 commits)")[![luceos](https://avatars.githubusercontent.com/u/504687?v=4)](https://github.com/luceos "luceos (2 commits)")[![askvortsov1](https://avatars.githubusercontent.com/u/38059171?v=4)](https://github.com/askvortsov1 "askvortsov1 (1 commits)")

---

Tags

flarumfriendsofflarumhacktoberfestflarum

### Embed Badge

![Health badge](/badges/fof-github-sponsors/health.svg)

```
[![Health](https://phpackages.com/badges/fof-github-sponsors/health.svg)](https://phpackages.com/packages/fof-github-sponsors)
```

###  Alternatives

[fof/byobu

Well integrated, advanced private discussions.

61105.8k9](/packages/fof-byobu)[fof/user-bio

Add a user bio to user profiles

2196.5k9](/packages/fof-user-bio)[fof/sitemap

Generate a sitemap

1988.7k2](/packages/fof-sitemap)[fof/drafts

Allow users to create post and discussion drafts

1771.1k5](/packages/fof-drafts)

PHPackages © 2026

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