State diagram
Stage details
Upload
You upload a ZIP file through the admin panel at System → Plugins → Upload. ThePluginSandbox scans the archive:
- Checks for a valid
manifest.json - Validates the plugin type and slug format
- Scans PHP files for blocked functions (
eval,exec, etc.) - Rejects the upload if any check fails
Install
If the upload passes validation:- The ZIP is extracted to
plugins/{slug}/ manifest.jsonis parsed and stored in theop_pluginsdatabase table- Database migrations in
migrations/run in order inside a transaction - The plugin enters the
installedstate
Install is platform-level - it happens once regardless of how many brands you have.
Activate
Activation is per-brand. When you activate a plugin for a brand:- The plugin class is instantiated
register()is called - hooks and filters are registeredboot()is called - the plugin can access services and the container- Routes from
routes/api.phpandroutes/web.phpare loaded - The plugin enters the
runningstate for that brand
Deactivate
Deactivation is also per-brand:- All hooks registered by this plugin for the brand are removed (
removeByOwner) - Routes are unloaded
- Data is preserved - database tables, settings, and files remain
Uninstall
Uninstall is irreversible and platform-level:- All migrations are reversed (
down()methods) inside a transaction - The
op_pluginsrow is deleted - All plugin files are removed from disk
- Settings stored in the database are deleted
Reinstall
To reinstall a plugin, upload the ZIP again. If the manifest version is higher, OwnPay runs any new migrations incrementally (it tracks which migrations have run).Brand-level vs platform-level
Update flow
- Upload a new ZIP with a higher
versioninmanifest.json - OwnPay detects the version bump and runs any new migrations
- Existing data is preserved
- If the plugin is active for a brand, it is automatically re-booted