Plugin Structure

When you create a plugin using the artisan command the following files are generated:

  • config.php
  • index.php
  • install.php
  • plugin.yml
  • Name.php


This is the main class of the plugin and it extends Plugin interface. Here you will add the functions and hooks needed for the functioning of the plugin.

All plugins must have a main() which is called when the plugin is first loaded.

If the plugin contains any hooks as methods, then it will stored in the HookContainer during load and the will be executed during the corresponding time.


When the user installs the plugin, this file is executed. It should have a database() method if it wants to run migrations to the application table.


This is the view file the admin will see when the admin visits plugin config page. This must be written in blade.


Any operations to be performed when the user updates the config file is done using this index file.


The information about the plugin is loaded from this file. This file should contain:

  • plugin_name
  • plugin_version
  • author_name
  • plugin_support_email
  • plugin_description

It may also contain

  • plugin_thumbnail_url
  • plugin_website