Skip to content
On this page

Plugin Development

From the framework level, the three channels of "extension plug-in", "control panel" and "website 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
└── extensions/         // Extensions directory (plugins and themes)
    └── 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/{unikey}/Resources/assets//public/assets/plugins/{unikey}/
Other FileNo Publish

plugin.json Config File

json
{
    "unikey": "DemoPlugin", // The only key, upper camel case
    "type": 1, // Type: 1.Extension plugin 2.Control Panel 3.Website Engine 4.Theme Template
    "name": "Demo Plugin",
    "description": "This is the demo plugin",
    "author": "Jarvis Tang",
    "authorLink": "https://github.com/jarvis-tang",
    "version": "1.0.0",
    "scene": [
        // Plugin usage scenarios
    ],
    "accessPath": "/mall", // Front-end visitor page path
    "settingPath": "/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
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
mapMap Service ProviderPanel > Systems > Maps
editorEditor PluginPanel > Operations > Publish
followGroupGroup Follow Mode SupportPanel > Operations > Groups
extendEditorEditor ExtensionsPanel > Expands > Editor
extendContentTypeContent Type ExtensionsPanel > Expands > Content Type
extendIpIP Service ProvidersPanel > Expands > Content Handler
extendNotificationNotification ProviderPanel > Expands > Content Handler
extendReviewReview Service ProviderPanel > Expands > Content Handler
extendDataData Service ProviderPanel > Expands > Content Handler
extendSearchSearch Service ProvidersPanel > Expands > Content Handler
extendManageManagement ExtensionsPanel > Expands > Manage
extendGroupGroup ExtensionsPanel > Expands > Group
extendUserUser Function ExtensionsPanel > Expands > User Feature
Panel > Expands > User Profile
engineWeb EnginePanel > Clients > Website
appNotificationMobile Notification Service ProviderPanel > Clients > App

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