'decoupling PHP plugin system

I am using PHP to build a simple plugin system in my own MVC framework. Here is the algorithm I am using to load the plugins:

  1. Scan the plugins directory.
  2. Use the wrapper pattern to wrap the plugin around the App class.
  3. The plugin will define its controllers and views. Now if the plugin controller returns a view name starting with Plugins then I will load the view in the plugins directory. For example, Plugins.Auth.views.index will load the index view of Auth plugin.
    Now I want a plugin to define a layout view that any plugin can use. It is an empty admin dashboard to which every plugin will add some functionality. How can I achieve this without moving the views to a single directory? I am using BladeOne as my templating engine.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source