Startup API/Feature Management

From StartupAPI
Jump to: navigation, search

Startup API provides some tools with managing application features.

Contents

Usage

Features are configured in user_config.php in your application.

Features class allows defining a feature which in turn can be assigned to Users and/or Accounts.

// define a readable name for unique 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 ...
}

Code roll-out

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)

Disable the feature

Features can also be globally disabled (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);

Operations

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 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
);

Admin interface

You can see the list of features and their current state in the admin interface on users/admin/features.php page.

Screenshots

Click on the images to see full-sized screenshot

Mockups

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox