PHP code example of fof / open-collective

1. Go to this page and download the library: Download fof/open-collective 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 / open-collective example snippets


use Flarum\Extend;
use FoF\OpenCollective\Event\BackerAdded;

return [
    (new Extend\Event)
        ->listen(BackerAdded::class, function (BackerAdded $event) {
            $user = $event->user;
            $email = $event->backerData->email ?? null;

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

use Flarum\Extend;
use FoF\OpenCollective\Event\BackerRemoved;

return [
    (new Extend\Event)
        ->listen(BackerRemoved::class, function (BackerRemoved $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
sh
composer update fof/open-collective
php flarum migrate
php flarum cache:clear