1. Go to this page and download the library: Download glueful/subscriptions 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/ */
use Glueful\Extensions\Subscriptions\Repositories\OverrideRepository;
use Glueful\Extensions\Subscriptions\Subject;
$overrides = new OverrideRepository();
// A workspace-level override (the 1.x meaning: the tenant's own subject).
$overrides->upsertForSubject($context, Subject::tenant($tenantUuid), 'projects.limit', 500);
// A member-level override, scoped to one user inside one workspace.
$overrides->upsertForSubject(
$context,
Subject::user($tenantUuid, $userUuid),
'content.premium',
false, // a DENY override
expiresAt: '2026-12-31 23:59:59', // optional
reason: 'chargeback hold', // optional
);
$overrides->deleteForSubject($context, Subject::tenant($tenantUuid), 'projects.limit');
$rows = $service->currentForTenants(['tenant-a', 'tenant-b']);
// ['tenant-a' => [...subscription row...], 'tenant-b' => [...]]
// an absent key means that tenant has no subscription -- never a null value
// In your app's ServiceProvider.
use Glueful\Extensions\Subscriptions\Contracts\SubjectResolverInterface;
public static function services(): array
{
return [
SubjectResolverInterface::class => [
'class' => YourAppSubjectResolver::class,
'shared' => true,
'autowire' => true,
],
];
}
use Glueful\Extensions\Subscriptions\Catalog\PlanCatalog;
use Glueful\Extensions\Subscriptions\Resolution\MemberEntitlementResolver;
$catalog = PlanCatalog::forScope($context, 'user', $tenantUuid); // THIS workspace only
$resolver = new MemberEntitlementResolver(
$catalog,
$subscriptionRepository,
$overrideRepository,
$effectivePlanResolver,
);
$map = $resolver->resolveMap($context, $tenantUuid, $userUuid);
text
GET /subscriptions/plans
POST /subscriptions/plans
POST /subscriptions/plans/import-config
GET /subscriptions/plans/{key}
PATCH /subscriptions/plans/{key}
POST /subscriptions/plans/{key}/archive