1. Go to this page and download the library: Download oofbar/membership 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/ */
oofbar / membership example snippets
use yii\base\Event;
use oofbar\membership\services\Permissions;
use oofbar\membership\events\GrantPermission as GrantPermissionEvent;
Event::on(
Permissions::class,
Permissions::EVENT_BEFORE_GRANT_PERMISSION,
function (GrantPermissionsEvent $e) {
// Optionally: prevent the grant from occurring, based on some criteria!
$e->isValid = false;
});
use yii\base\Event;
use oofbar\membership\services\Permissions;
use oofbar\membership\events\RevokePermission as RevokePermissionEvent;
Event::on(
Permissions::class,
Permissions::EVENT_BEFORE_REVOKE_PERMISSION,
function (RevokePermissionsEvent $e) {
// Optionally: prevent the revocation from occurring, based on some criteria!
$e->isValid = false;
});
bash
php craft plugin/install membership
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.