Comment on page

Main Plugin Instance

Your plugin should have exactly one class that implements the PluginInterface interface. If you have a very simple plugin, it can be the only class you have, but you need to have it. For convenience, the PluginTrait trait provides a basic implementation for most methods.
Basically what this interface enforces is a way to retrieve the most useful information from the plugin's header comment. The AbstractPlugin class even goes a step further and actually retrieves all the values from said comment during the local initialization action.
Therefore it would be enough to have a file Plugin.php that looks a bit like this:
namespace DeepWebSolutions\Plugins\MyTestPlugin;
use DeepWebSolutions\Framework\Foundations\Plugin\AbstractPlugin;
\defined( 'ABSPATH' ) || exit;
class MyPlugin extends AbstractPlugin {
public function get_plugin_file_path(): string {
return $path_to_file_with_plugin_header_comment;
$plugin = new MyPlugin();
echo $plugin->get_plugin_version(); // echoes whatever the version header line is set to
As always, our example plugin provides a more complex example (albeit it relies on the extended classes provided by the Core Module).