Define the feature constant
Add a unique name on the PHP Feature model. The string must match the row you insert in addins.features.
api/common/modules/featurechecker/models/Feature.php
Ship a capability that is gated by subscription plan: register it in the addins database, enforce it in PHP, then wire plans in ST-admin.
Add a unique name on the PHP Feature model. The string must match the row you insert in addins.features.
api/common/modules/featurechecker/models/Feature.php
Create a migration that extends FeatureMigration so the feature row is inserted into addins.
api/console/migrations/
Assign plan_features for existing plans via a second migration, or use ST-admin on draft plans only.
api/console/migrations/ or Plans & features
Apply changes to the addins database (local stack or api container).
scripts/migrate.sh or cd api && php yii migrate
Gate API and UI with FeatureChecker so only accounts on plans that include the feature can use it.
api / dashboard controllers
Open Plans & features: new row in the matrix, toggle on draft plans, Go live when ready to sell.
/plans-features
// In Feature.php
const FEATURE_MY_NEW_CAPABILITY = 'MY_NEW_CAPABILITY'; Extend FeatureMigration; it inserts into {{features}} if the name is not already present.
<?php
use console\models\FeatureMigration;
use common\modules\featurechecker\models\Feature;
class m260520_120000_add_my_feature extends FeatureMigration
{
protected function getFeatureNames()
{
return Feature::FEATURE_MY_NEW_CAPABILITY;
}
}use common\modules\featurechecker\FeatureCheckerModule;
use common\modules\featurechecker\models\Feature;
$allowed = FeatureCheckerModule::getFeatureChecker()
->can(Feature::FEATURE_MY_NEW_CAPABILITY);
if (!$allowed) {
throw new ForbiddenHttpException('Not available on your plan');
} Click cells to toggle plan_features. Use New draft plan to experiment without touching live plans.
Makes the plan purchasable. Feature links you set on the draft are kept.
Stops new sales. Existing subscribers keep their plan; matrix is read-only for feature links.
features.name. isDraft=1). FeatureChecker::can() call site (editor may use API only). m260519_100000_add_is_draft_to_plans ran on addins.