Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a360c12e6b
Fetching contributors…

Cannot retrieve contributors at this time

97 lines (75 sloc) 2.688 kb


This library intends to provide a simple way to manage plugins for an erlang application, right now the abstraction is very simple and high level but it is quite flexible.


Simply start the applicaiton, there is only one configuration variable at the moment named plugin_dir which as the name suggets specifies where the plugins are discovered. It defaults to plugsin.


And respectively apply/1 which is the same as apply/2 with empty args.

This function can be used to call all the functions that were registered to a certain callback, with the args given as seconds argument.

eplugin:apply(my_fancy_callback, [1, 2, 3]).


The basis for apply, this function returns all modules and functions registered for a certain callback. It returns: [{Module, Function}]

%% -> [{some_module, some_function}, {some_other_module, some_function}]


Fetches the custom plugin Config. This can is not tied to anything but simply can be used to store whatever plugin config is required.

%% -> {ok, Config}


This function lists all installed plugins.


Enables a plugin.


disables a plugin.


Returns true if a plugin is enabled (aka has any callbacks registered).

Writing plugins

A plugin is a directory with a plugin.conf file and one or more .erl files so the a plugin directory could look like:


Please be aware that module names need to be unique!

The plugin.conf is a simple file with the following syntax:

 [{Module, [{Callback, Function}]}],

OptionsPlist has the following reserved options:

  • disabled - this plugin will not load.
  • dependencies - a list of dependencies.
  • provides - a list of dependencies the plug provides.



callbacks are noted as <callback name>(arguments) so eplugin:init(Config) means the callback eplugin:init is caled with 1 argument - Config.

internal callbacks

eplugin provides the following callbacks itself:

  • eplugin:enable(Config) - this is called before a module gets enabled.
  • eplugin:disable(Config) - this gets called after a module gets disabled.
  • eplugin:enable_plugin(Plugin) - this gets called whenever a plugin is enabled.
  • eplugin:disable_plugin(Plugin) - this gets called whenever a plugin is disabled.
Jump to Line
Something went wrong with that request. Please try again.