Skip to content

Plugin Development

From the framework level, the three channels of "extension plug-in", "control panel" and "web engine" in the "management background" are plug-ins. Though their business directions are different, their development is essentially the same.

Directory Structure

php
fresns/             // Main program root directory
└── plugins/            // Plugins directory
    └── DemoPlugin/         // Example plugin
        ├── app/
        ├── config/
        ├── database/
        ├── resources/
   ├── assets/
   ├── fresns.png  // Plugin cover image (square), must be present and fixed in position
   ├── js/
   └── app.js
   └── sass/
       └── app.scss
   ├── lang/
   └── views/
        ├── routes/
        ├── tests/
        ├── plugin.json
        └── composer.json

File Publish

When the plugin is installed and published, static resources are distributed to the public directory.

Plugin FolderPublish to the site resource directory
/extensions/plugins/{fskey}/Resources/assets//public/assets/plugins/{fskey}/
Other FileNo Publish

plugin.json Config File

json
{
    "fskey": "DemoPlugin", // The only key, upper camel case
    "name": "Demo Plugin",
    "description": "This is the demo plugin",
    "author": "Jevan Tang",
    "authorLink": "https://github.com/jevantang",
    "version": "1.0.0",
    "scene": [
        // Plugin usage scenarios
    ],
    "accessPath": "/mall", // Front-end visitor page path
    "settingsPath": "/mall/admin", // Back-end settings page path
    "providers": [
        "Plugins\\FresnsEmail\\Providers\\FresnsEmailServiceProvider",
        "Plugins\\FresnsEmail\\Providers\\CmdWordServiceProvider",
        "Plugins\\FresnsEmail\\Providers\\EventServiceProvider"
    ],
    "autoloadFiles": [
        // autoload files
    ],
    "aliases": {}
}
  • Plugin usage scenario scene parameters
Scene ParametersDescriptionControl Panel Location
apiKeyPlugin requires key servicePanel > App Center > App Keys
registerConfiguration of the "public mode" registration functionPanel > Systems > General
joinConfiguration of the "private mode" registration functionPanel > Systems > General
sendEmailEmail Service ProviderPanel > Systems > Send
sendSmsSMS Service ProviderPanel > Systems > Send
appNotificationMobile Notification Service ProviderPanel > Systems > Send
connectAccount Connect SupportPanel > Systems > User
realNameReal Name Authentication SupportPanel > Systems > User
multiUserMulti-User Mode SupportPanel > Systems > User
rechargeWallet Recharge Service ProviderPanel > Systems > Wallet
withdrawWallet Withdrawal Service ProviderPanel > Systems > Wallet
storageStorage Service ProviderPanel > Systems > Storage
editorEditor PluginPanel > Operations > Publish
followGroupGroup Follow Mode SupportPanel > Operations > Groups
extendEditorEditor ExtensionsPanel > Extends > Editor
extendContentTypeContent Type ExtensionsPanel > Extends > Content Type
extendIpIP Service ProvidersPanel > Extends > Content Handler
extendMapMap Service ProvidersPanel > Extends > Content Handler
extendNotificationNotification ProviderPanel > Extends > Content Handler
extendReviewReview Service ProviderPanel > Extends > Content Handler
extendDataData Service ProviderPanel > Extends > Content Handler
extendSearchSearch Service ProvidersPanel > Extends > Content Handler
extendManageManagement ExtensionsPanel > Extends > Manage
extendGroupGroup ExtensionsPanel > Extends > Group
extendUserUser Function ExtensionsPanel > Extends > User Feature
Panel > Extends > User Profile
extendChannelChannel ExtensionsPanel > Extends > Channel
websiteWebsite PluginPanel > Clients > Website

composer.json Config File

json
{
    "name": "fresns/fresns-email",
    "license": "Apache-2.0",
    "require": {
        "laravel/email": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "Plugins\\FresnsEmail\\": "./"
        }
    }
}

Released under the Apache-2.0 License