Skip to content

Faveo Plugin creation guide

Bhanu edited this page Aug 24, 2018 · 6 revisions

Introduction

Faveo is providing option to create plugins. Before creating plugin you should understand how plugin system is working. Faveo plugin is similar to Laravel packages. The only difference is it doesn’t have composer update option.

In app/Plugins has one ServiceProvider.php that is extend to \Illuminate\Support\ServiceProvider.

How to install plugins in Faveo

Two ways clients can install plugin from admin panel and pasting plugin folder in app/Plugins

Installation from admin panel

Upload plugin zip file; When submit the file a post method has been triggered to Common/SettingsController.php. There, zip file has been extracted to app/Plugins and uploaded plugin’s service provider path (eg: app/Plugins{pluginName}/ServiceProvider) put in into Config/app.php file in providers array.

Installation manually

Paste the plugin folder in app/Plugins and give the service provider path (eg: app/Plugins/{pluginName}ServiceProvider) in config/app.php at providers array. Fetching plugins’ list to admin panel plugin module/page In Common/SettingsController.php has a function getPlugin() will fetch the plugin configurations and return as chumper datatable. It lists all the plugins folders. And giving option to delete and activate/deactivate the plugin

Activate/Deactivate Plugin

Activate puts the path (eg: app/Plugins/{pluginName}ServiceProvider) in config/app.php in providers array. Deactivate comments the path (eg: app/Plugins/{pluginName}/ServiceProvider) in provider array

Deleting

Deleting plugin, deletes the plugin folder from app/Plugins, commenting the path (eg: app/Plugins/{pluginName}/ServiceProvider) in config/app.php at providers array and finally deletes the plugin from database.

Database

Faveo database has table called plugin when a new plugin installed or activate, plugin name is inserting with status 1 (active). Creating Plugin

Required Files

  • config.php
  • ServiceProvider.php
  • routes.php

Config.php

In config.php you should provide name, description, author, website, version, settings. Settings is url name of the settings route.

ServiceProvider.php

Plugin ServiceProvider class should extend to App\Plugins\ServiceProvider and their you can register your plugin and give the boot instruction (eg: publish, migration, view load, translation load etc). Highly recommend to register service provider as plugin folder name.

Eg: In app/Plugins/Social/ServiceProvider.php

Register method is

public function register() {
       parent::register(‘Social’);
   }

In boot method add

parent::boot(‘Social’);

Routes.php

This is a normal route file, when you register (put path to config/app.php), by default routes also registering. Highly recommend to use your plugin name as prefix to avoid conflicts. Here you can listen to Faveo Events.

Controllers, Request and Model

Controllers, Request and Model you can create normally and extend to faveos’ corresponding class such as App\Http\Controllers\Controller; App\Http\Requests\Request; and Illuminate\Database\Eloquent\Model; respectively

After completing plugin creation move all files in a folder and compress this folder into “.zip” file.

Note: Name of your plugin folder and zip file should be same.

References

Installation and Upgrade Guide

Administrator's Guide

Agent's Guide

Email Integration

Release & Upgrade Notes

Known Issues

Contribute & Feedback

Knowledge Base

Third Party Integration

Plugins

API

Clone this wiki locally