ProcessWire Modules

ProcessWire is built around a modular architecture

Modules exist to enable a high level of extensibility and customization to an installation of ProcessWire. Modules are PHP files containing classes that adhere to ProcessWire's Module interface.

Installing a module is as simple as uploading the module's files to the /site/modules/ directory on your server and then clicking "install" in the Admin. Uninstalling is as simple as clicking "uninstall" in the module's settings, and then deleting it's directory from the server.

Modules may add hooks to methods/functions in ProcessWire's core, or to other modules. Nearly every component and action in ProcessWire is hookable. Much of ProcessWire itself is a collection of plugin modules. In fact, the ProcessWire admin application is just a group of modules, not actually part of ProcessWire's core.

Modules can schedule themselves to be executed before or after a given function/method in ProcessWire. They can manipulate the values provided to, or returned from, any method/function. Modules may also add new functions/methods to existing ProcessWire API objects. ProcessWire comes with a module interface for implementing any kind of plugin, as well as a few abstract and base objects for which predefined module types are defined.

Predefined modules

Examples of predefined module interfaces in ProcessWire include interfaces for field types (Fieldtype modules), form fields (Inputfield modules), admin processes (Process modules), text formatters (Textformatter modules), jQuery plugins (Jquery modules), and markup generation (Markup modules).

Naming conventions
When creating new modules that fall in this class of predefined types, naming conventions should be used to identify the module as being of that type. For instance, if you create a new Textformatter module called "Something" you should name it "TextformatterSomething". Likewise, a new Inputfield module called "SuperCheckbox" should be named "InputfieldSuperCheckbox". Naming conventions you would use at the beginning of the module class name are: Textformatter, Fieldtype, Inputfield, Process, Jquery, and Markup. For modules that aren't based on these existing types, you don't need to consider naming conventions.

Plugin modules can be designated to be bootstrapped with ProcessWire, or only loaded when requested by the API. Modules may also be specified as single or multiple instance.

Module example

Despite the technical sounding description, creating a module is very simple. ProcessWire includes a "Hello World" module that demonstrates the basics and includes a lot of commenting. Here is a simple example of a module that displays a message every time a page is saved:

class Example extends WireData implements Module {
        public static function getModuleInfo() {
                return array(
                        'title' => 'Example module',
                        'version' => 100,
                        'summary' => 'Display message when pages are saved',
                        'singular' => true,
                        'autoload' => true
        public function init() {
                $this->pages->addHookAfter('save', $this, 'exampleMethod');
        public function exampleMethod($event) {
                $page = $event->arguments[0];
                $this->message("You just saved page: {$page->url}");

Creating Modules

For full details on how to create a module, please see our Module API Reference documentation section.

Learning by example

Take a look at the Hello World module included with your ProcessWire installation in the file /site/modules/Helloworld.module.

Also take a look at the Process Hello module which demonstrates how to build an admin tool.

The Fieldtype Map Marker module was originally put together as an example of how to create your own Fieldtype and Inputfield (though this is a more advanced example).

How to use hooks

Many modules do their work by attaching hooks. Learn how hooks work and what hooks are available.

Need to do something and can't find a hook to do it? Just ask, usually we can add it.

Module dependencies

When a module requires or installs one or more other modules, these are called module dependencies. Learn about module dependencies and how to use them.

Module development support

Need help with module development? We are glad to help and have a forum board dedicated to it. Please stop by and say hello.

Just in case you missed it before, there are tons of great examples in our modules directory.

Module-specific information