The Base directory contains all the tools we will use in your plugin. The base directory also contains the files that run when we deactivate and activate the plugin.
Recall that in the domain-core.php file, we added the register activation and register deactivation hooks. These hooks call methods which reference the following classes.
The BaseController directory will there have the following files.
We will import the package and namespace lines for these three files from the Init.php file.
Make changes to the namespace in these three files. Since all the three files are inside the Base directory, we need to append it to the new namespace. Therefore, the new namespace should be Domain_Core\Base.
Open the Activate.php file and add the following code.
The Activate Class has the activate method, which flushes rewrite rules when the plugin is activated.
Open the Deactivate.php file and add the following code.
The Deactivate Class has the deactivate method, which also flushes rewrite rules when the plugin is activated.
You can call more functions when activating or deactivating the plugin by adding functions inside in their respective activate and deactivate methods.
Open the BaseController.php file and add the following code.
We use the BaseController class to set up a series of base methods. These methods are plugin references for stuff such as the plugin directory path, among others.