Plugin Directory Structure

Hi, is there a way to customize the plugin directory, for instance, On another modular CMS system I develop plugins for there is this structure, which I find rather organized and wanted to reproduce, slightly updated to fit the directory names of OC

* author
       -> plugin
             -> config
             -> updates
             -> src
                      * **Plugin Code Here ***
             -> tests
             Plugin.php
             plugin.yaml
             composer.json

Hi and welcome @skillcraft-io

Plugins are somewhat contrarian to the /src pattern, acting more like extensions than libraries. Using a /src directory may be possible if you use composer to autoload that directory, with a couple of exceptions:

  • the assets directory cannot go in there since it is used as a public path (yoursite.tld/plugins/author/plugin/assets/css,js,etc).

  • resolved view paths do not anticipate a src/ node in the path, so explicit references would be used everywhere

We could add the ability to use a src folder, if there is a good enough reason. However, in most cases, we just use a public directory and then the whole plugin becomes internal, except assets. The october:mirror creates a public folder and symlinks all the asset directories there.

The command is:

php artisan october:mirror

Interesting, thanks for the information :slight_smile: