This is a demo. Its data may be reset from time to time.
Sandbox
Developer Guide

Plugin Development

A plugin adds features to FinAegis without changing the core code. It listens to hooks, declares its permissions and runs inside a sandbox.

Quick Start

1

Scaffold a plugin

Terminal
php artisan plugin:create my-company payment-analytics

The command creates this structure.

Directory Structure
plugins/my-company/payment-analytics/
├── plugin.json              ← Manifest (metadata, permissions, deps)
├── src/
│   └── ServiceProvider.php  ← Entry point (register + boot)
├── routes/
├── config/
├── migrations/
└── tests/
2

Configure the manifest

plugin.json
{
  "vendor": "my-company",
  "name": "payment-analytics",
  "version": "1.0.0",
  "display_name": "Payment Analytics",
  "description": "Real-time payment analytics and reporting dashboard",
  "author": "My Company",
  "license": "Apache-2.0",
  "entry_point": "ServiceProvider",
  "permissions": [
    "database:read",
    "events:listen",
    "cache:read",
    "cache:write"
  ],
  "dependencies": {},
  "extra": {
    "dashboard_url": "/admin/payment-analytics"
  }
}
3

Register a hook listener

src/ServiceProvider.php
namespace Plugins\MyCompany\PaymentAnalytics;

use App\Infrastructure\Plugins\PluginHookInterface;
use App\Infrastructure\Plugins\PluginHookManager;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

class ServiceProvider extends BaseServiceProvider
{
    public function boot(): void
    {
        // Register hook listener for completed payments
        $this->app->make(PluginHookManager::class)
            ->register(new PaymentCompletedListener());
    }
}

class PaymentCompletedListener implements PluginHookInterface
{
    public function getHookName(): string
    {
        return 'payment.completed';
    }

    public function getPriority(): int
    {
        return 10; // Lower = runs first
    }

    public function handle(array $payload): void
    {
        // $payload contains payment data
        Log::info('Payment analytics: tracking', $payload);
    }
}
4

Install and enable

Terminal
php artisan plugin:install plugins/my-company/payment-analytics
php artisan plugin:enable my-company/payment-analytics
php artisan plugin:list

Available Hooks

A plugin registers listeners for these hook points. The listeners run one after another. If one listener throws an exception, the platform logs it and still runs the others. Today the platform fires five of these hooks: account.created, payment.completed and payment.failed for deposits, order.placed and order.matched. The other hook points are defined but not fired yet.

Account

account.created An account was created
account.updated Account details changed

Payments

payment.initiated A payment started
payment.completed A deposit completed
payment.failed A deposit failed

Wallet

wallet.created A wallet was created
wallet.transfer A wallet transfer happened

Compliance

compliance.alert A compliance alert was raised
compliance.kyc An identity check changed status

Exchange

order.placed An exchange order was placed
order.matched An order was matched

Lending

loan.applied A loan application was sent
loan.approved A loan was approved

Cross-Chain

bridge.initiated A bridge transfer started
bridge.completed A bridge transfer completed

Decentralised Finance

defi.position.opened A decentralised finance position was opened
defi.position.closed A decentralised finance position was closed

Permission Model

Plugins declare required permissions in plugin.json. The sandbox checks them while the plugin runs. Access that the plugin did not declare throws a RuntimeException.

Category Permission Description
Data Access database:read Read from database tables
database:write Write to database tables
API api:internal Access internal API endpoints
api:external Make outbound HTTP requests
Events events:listen Listen to application events
events:dispatch Dispatch application events
Infrastructure queue:dispatch Queue background jobs
cache:read Read from cache
cache:write Write to cache
filesystem:read Read files
filesystem:write Write files
config:read Read application configuration

Security Scanner

The security scanner checks a plugin's code for dangerous patterns. You run it with plugin:verify, from the admin panel or through the API. It sorts what it finds into four levels.

Critical

These are the most serious findings. They include eval(), exec(), shell_exec(), system(), backtick execution and dynamic includes.

High

These findings need a careful review. They include DB::raw(), unserialize(), extract() and direct env() access.

Medium

These findings are warnings. They include remote file_get_contents() and curl_exec() calls. Declare the api:external permission instead.

Low

These findings are for information. They point to unusual code that may need a second look.

Run scanner manually
php artisan plugin:verify my-company/payment-analytics

Plugin Lifecycle

Scaffold
Install
Enable
Active
Disable
Remove
Command Action
plugin:create {vendor} {name}Creates the plugin folder and its manifest
plugin:install {path}Checks the manifest, resolves dependencies and registers the plugin as inactive
plugin:enable {vendor/name}Turns the plugin on, boots its service provider and registers its hooks
plugin:disable {vendor/name}Turns the plugin off and removes its hooks
plugin:remove {vendor/name}Deletes the plugin. System plugins cannot be removed.
plugin:listLists all plugins and their status
plugin:verify {vendor/name}Runs the security scanner on the plugin code

Manifest Reference

These are all the fields of plugin.json.

Field Type Required Description
vendorstringYesVendor identifier (alphanumeric, hyphens, underscores)
namestringYesPlugin name (alphanumeric, hyphens, underscores)
versionstringYesSemantic version (X.Y.Z)
display_namestringNoHuman-readable name (defaults to name)
descriptionstringNoPlugin description
authorstringNoAuthor name
licensestringNoLicense type (default: Apache-2.0)
entry_pointstringNoServiceProvider class name (default: ServiceProvider)
permissionsstring[]NoRequired permissions (see table above)
dependenciesobjectNoSemver constraints: {"vendor/name": "^1.0"}
extraobjectNoCustom metadata, such as dashboard links and a settings schema

REST & GraphQL APIs

You can also manage plugins through the REST API or through GraphQL.

REST Endpoints

GET /api/v2/plugins
GET /api/v2/plugins/{id}
POST /api/v2/plugins/{id}/enable
POST /api/v2/plugins/{id}/disable
POST /api/v2/plugins/{id}/scan
POST /api/v2/plugins/discover
DELETE /api/v2/plugins/{id}

GraphQL Operations

Query plugin(id: ID!)
Query plugins(status: String)
Query pluginMarketplaceStats
Mutation enablePlugin(id: ID!)
Mutation disablePlugin(id: ID!)
Mutation scanPlugin(id: ID!)