Directory Structure
plugin/
└── foo
├── app
│ ├── controller
│ │ └── IndexController.php
│ ├── exception
│ │ └── Handler.php
│ ├── functions.php
│ ├── middleware
│ ├── model
│ └── view
│ └── index
│ └── index.html
├── config
│ ├── app.php
│ ├── autoload.php
│ ├── container.php
│ ├── database.php
│ ├── exception.php
│ ├── log.php
│ ├── middleware.php
│ ├── process.php
│ ├── redis.php
│ ├── route.php
│ ├── static.php
│ ├── thinkorm.php
│ ├── translation.php
│ └── view.php
├── public
└── api
We can see that an application plugin has the same directory structure and configuration files as webman. In fact, the development experience is basically no different from developing a standard webman application. The plugin directory and naming follow the PSR4 specification. Since the plugins are placed under the plugin directory, the namespace all starts with plugin
, for example, plugin\foo\app\controller\UserController
.
About the api Directory
Each plugin contains an api directory. If your application provides some internal interfaces for other applications to call, the interfaces should be placed in the api directory. Note that the interfaces mentioned here refer to function call interfaces, not network call interfaces. For example, the email plugin
provides an Email::send()
interface in plugin/email/api/Email.php
for other applications to call to send emails. Additionally, plugin/email/api/Install.php
is auto-generated and is used to allow the webman-admin plugin market to perform installation or uninstallation operations.