-
Notifications
You must be signed in to change notification settings - Fork 24
Feature Management
Startup API provides some tools with managing application features.
Features are configured within user_config.php
file in your application.
Feature
class allows defining a feature which in turn can be assigned to User
s and/or Accounts
.
// define a readable name for unique integer feature ID for use in your code
define('MYAPP_MYFEATURE_NAME', 1); // never change this number
new Feature(MYAPP_MYFEATURE_NAME, 'My Feature Name');
Application code then can make simple checks if current user has feature enabled and enable / disable functionality.
if ($current_user->hasFeature(MYAPP_MYFEATURE_NAME)) {
... code of the feature ...
}
Features can be available to a user under following scenarios:
- Feature is explicitly rolled-out to this user
- Feature is explicitly rolled-out to account user is currently logged in with
- Feature is globally rolled-out to all users
- Feature is available under the subscription plan for current account (coming soon)
Features can also be globally disabled by passing FALSE
as 3rd argument to constructor (useful for testing the code or discontinuing features).
// define unique feature ID for use in your code
define('MYAPP_MYFEATURE_NAME', 1);
new Feature(MYAPP_MYFEATURE_NAME, 'My Feature Name', FALSE);
In addition to disabling features globally, they can be temporarily disabled due to system load or outage.
Features are also ranked for emergency shutdown - application administrators can write a load/issue detection logic in their user_config.php
files that will auto-scale down the system.
// define unique feature ID for use in your code
define('MYAPP_MYFEATURE_NAME', 1);
new Feature(MYAPP_MYFEATURE_NAME, 'My Feature Name',
TRUE, // enabled
TRUE, // rolled-out to all users
5, // emergency shutdown priority
FALSE // change to true to temporarily shut down
);
You can see the list of features and their current state in the admin interface on http://yoursite/users/admin/features.php
page.