Plugins are located in their own folder in plugins/my-plugin-name, when they are zipped they should contain a single folder my-plugin-name with all plugin files inside.

A valid plugin must have at least a file named plugins/my-plugin-name/plugin.php that must include a comment header with plugin information like name, author, url etc.

<?php
/*
Name: Insert Footer Header Scripts
Slug: insert-scripts
Category: tools
Url: http://www.vvveb.com
Description: Insert footer and header scripts such as analytics or widgets.
Thumb: insert-scripts.svg
Author: givanz
Version: 0.1
Author url: http://www.vvveb.com
Settings: /admin/?module=plugins/insert-scripts/settings
*/

use Vvveb\System\Event;

if (! defined('V_VERSION')) {
    die('Invalid request!');
}

class InsertScriptsPlugin { ...
?>

Slug must match folder name.

Settings is optional and must define the path for plugin page or configuration controller.

Folder structure

The plugin structure is similar to the cms structure, having the same folders like admin, app, public, system etc.

The plugin should follow the following structure, this is a complete structure for all optional features that a plugin can include.

  • ├── plugin.php - main plugin file
  • ├── plugin.svg - plugin thumbnail
  • └── app
    • └── controller
      • └── index.php - plugin controller for optional frontend page
    • └── template
      • └── common.tpl - general template file
      • └── index.tpl - plugin page template
    • └── validate
      • └── plugin-form.php - validation file if necessary
  • └── admin
    • └── controller
      • └── index.php - plugin controller for optional frontend page
    • └── template
      • └── settings.tpl - settings page template
    • └── validate
      • └── plugin-form.php - validation file if necessary
  • └── public
    • ├── admin
      • └── settings.html - html template for plugin settings page
    • ├── app
      • └── index.html - html template for plugin frontend page
    • ├── js
      • └── plugin.js - optional js files
    • ├── css
      • └── plugin.css - optional css files
  • └── install - in rare cases where the plugin needs setup like table creation
    • └── sql
      • └── mysql
        • └── plugin.sql - optional mysql queries to create plugin tables
      • └── pgsql
        • └── plugin.sql - pgsql queries
      • └── sqlite
        • └── plugin.sql - sqlie queries
  • └── sql
    • └── mysql
      • └── plugin.sql - mysql queries needed by plugin
    • └── pgsql
      • └── plugin.sql - pgsql queries
    • └── sqlite
      • └── plugin.sql - sqlite queries
  • └── component
    • └── mycomponent.php - custom component added by plugin
  • └── system
    • └── plugin.php - custom functions or libraries
    • └── library.php - custom functions or libraries
  • └── vendor - optional 3rd party libraries