Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Basic Usage

First I will introduce you to Main class and it’s functions then we dig deeper in each function that you can use.

Main class is located in ./app/Main.php.

This class is extending StartUp class, which is responsible for loading our plugin different parts.

In Main class you see these methods that are overriding StartUp class methods:


init method

Codes that are written in init method, will be executed every where.


components method

We use this method to register our components. read Components.


onAdmin method

Codes written in this method will only be executed on admin area.

for example enqueueing an asset or adding an action.


api method

We use this method to register our api endpoints. read API.


activation method

As you already guessed this is our activation method. By default, it will run migrations and seeds. For more detail about migrations and seeders read Database.

You can add your custom activation codes between START & END comment section


deactivation

No explanation needed, You already know.


uninstallation

By default, it will roll back all changes made to database using phinx read Database.


Table of contents