# How it works

This module is **by far** the simplest among all of them. But it only works if a couple of things that are fulfilled:

1. It must be the very first thing that the plugin loads.
2. The other modules (and the plugin itself) must refuse to continue running if this module fails to initialize.

Luckily, the first condition is pretty simple to fulfill. The module's entry point is the `bootstrap.php` file (just like all the other modules, actually) and it is defined in [the `composer.json` file](https://github.com/deep-web-solutions/wordpress-framework-bootstrapper/blob/master/composer.json) as an autoload target. Since every single other module also depends on the Bootstrapper module, Composer's autoloader will ensure this file is the first one to load across the entire framework.

As far as the second condition is concerned, you can rest assured that our other modules to follow it. As for your own plugin, well, that depends on you so we're probably covered again!

On a functional level, the file `bootstrap-functions.php` contains the checker function. The main logic is handled by the **very** simple `dws_wp_framework_check_php_wp_requirements_met` function.

If the minimum requirements are met, the namespaced constant `DWS_WP_FRAMEWORK_BOOTSTRAPPER_INIT` is set to true, otherwise it is set to false [in `bootstrap.php`](https://github.com/deep-web-solutions/wordpress-framework-bootstrapper/blob/master/bootstrap.php). It is best to **not** access the constant directly, but through use of the helper function `dws_wp_framework_get_bootstrapper_init_status` defined [in `bootstrap-functions.php`](https://github.com/deep-web-solutions/wordpress-framework-bootstrapper/blob/master/bootstrap-functions.php).

Should the constant be set to false, the module also outputs [the `requirements-error.php` template](https://github.com/deep-web-solutions/wordpress-framework-bootstrapper/blob/master/src/templates/requirements-error.php) as an admin notice. This notice will contain the name of the module that failed to initialize and provide some more information about what went wrong.

{% hint style="warning" %}
If the Bootstrapper module fails, all subsequent framework modules will fail too. However, the admin notice will only be outputted **only once** and will contain the name of the **first module** that failed only.
{% endhint %}

Here is an example of what the notice looks like:

![Default requirements error admin notice](/files/-MXlkX2chcY0I-5Kftbv)


---

# Agent Instructions: 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:

```
GET https://framework.deep-web-solutions.com/bootstrapper-module/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
