Extending Lorekeeper

From Lorekeeper Wiki
Revision as of 08:52, 2 June 2021 by Mercury (talk | contribs) (Created page with "Since its release, many and varied extensions have been written and released for Lorekeeper. These modifications to the framework's code allow for a v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Since its release, many and varied extensions have been written and released for Lorekeeper. These modifications to the framework's code allow for a variety of new functionality that (given the inherently opt-in nature of extensions) allows them to serve many and in fact many different potential use cases for Lorekeeper itself.

Should you want to author an extension of your own, there are certain guidelines you should follow in the interest of making the process as smooth as possible for all participants. This article covers these, as well as registering your extension on this wiki and releasing it to the public. Note that this does not cover making the modifications themselves.

Note that this article covers the creation and releasing of extensions; for installing them, see Tutorial: Installing Extensions.

Creating an Extension

Before you begin any work, it's useful to have and/or keep in mind a few things.

  • You must have a local instance on which to work.
    • This is non-negotiable when making significant changes to Lorekeeper, extension-writing included. Working in a dev environment is inherently more conducive to, well, development; in this case it includes easier display of errors, ability to simply save files and see the modifications reflected on your dev environment (without having to commit+push), and so on.
  • Lorekeeper, as of v2.0.0, requires PHP 7.4...

Identifying the Extension's Purpose

First and foremost, you need an idea as to what your extension will do. Some potential sources of inspiration are:

  • Is there a feature or function that would be helpful to you/a site you run that does not currently exist either in Lorekeeper or an extension?
  • Does one of the ideas in the Community Feature Request document interest you?

You might also be hired to write an extension to serve a specific purpose.

Once you have an idea of what your extension should do, you should think about how you want to implement it. It can be helpful to think about existing structures in Lorekeeper or extensions that serve similar purposes, or might work a similar way to how your extension could work. Especially if referencing an extension, it may be helpful to consult the extension's author(s) for insight, keeping in mind to be respectful of their time and energy.

However works best for you, it can be helpful to plan out things such as:

  • Database modifications
  • Creation and/or editing of models
  • Creation and/or editing of views

before actually writing any code.