> For the complete documentation index, see [llms.txt](https://framework.deep-web-solutions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://framework.deep-web-solutions.com/plugin/main-plugin-instance.md).

# Main Plugin Instance

Your plugin should have exactly one class that implements the [`PluginInterface`](https://github.com/deep-web-solutions/wordpress-framework-foundations/blob/master/src/includes/Plugin/PluginInterface.php) 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`](https://github.com/deep-web-solutions/wordpress-framework-foundations/blob/master/src/includes/Plugin/PluginTrait.php) 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](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/). The [`AbstractPlugin`](https://github.com/deep-web-solutions/wordpress-framework-foundations/blob/master/src/includes/Plugin/AbstractPlugin.php) class even goes a step further and actually retrieves all the values from said comment during the [local initialization action](/foundations-module/actions/local-action-traits.md).

Therefore it would be enough to have a file `Plugin.php` that looks a bit like this:

```php
<?php

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();
$plugin->initialize();

echo $plugin->get_plugin_version(); // echoes whatever the version header line is set to

```

As always, our [example plugin](https://github.com/deep-web-solutions/wordpress-plugins-utility) provides a more complex example (albeit it relies on the extended classes provided by the [Core Module](https://packagist.org/packages/deep-web-solutions/wp-framework-core)).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://framework.deep-web-solutions.com/plugin/main-plugin-instance.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
