PHP code example of fof / github-sponsors

1. Go to this page and download the library: Download fof/github-sponsors library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fof / github-sponsors example snippets


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.
        }),
];

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.
        }),
];
sh
composer  migrate
php flarum cache:clear
bash
php flarum fof:github-sponsors:update
sh
composer update fof/github-sponsors
php flarum migrate
php flarum cache:clear