1. Home
  2. Docs
  3. Application Framework
  4. Classes & Patterns

Classes & Patterns

@PSR-4 Autoloading

Classes for your plugin are automatically loaded according to the PSR-4 autoload standard. This means that if you create a new class using the provided scaffolding mechanisms built into the MWP Framework, there is no need to include them manually before using them.

/* plugin-dir/classes/Autoloadable.php */
namespace VendorName\PackageName;

class Autoloadable {

}

@Extensible Autoloading

In addition to the standard PSR-4 autoloading scheme included with plugins, the framework itself has a custom autoloading mechanism built into it which allows any class that conforms to the PSR-4 standard to opt in to special extensibility through other plugins and themes with a simple underscore prefix. This extensibility pattern is described in the Class Extensibility documentation.

/* plugin-dir/classes/AutoloadableAndExtensible.php */
namespace VendorName\PackageName;

class _AutoloadableAndExtensible {

}
Was this article helpful to you? Yes No

How can we help?