Search

Erply Plugin SDK

Introduction

Erply plugin standard development kit is a new platform for plugin developers. The purpose of the SDK is to provide easy to use and reliable standard components such as PSR-3 logger, API wrapper, filesystem / database access. Furthermore, it makes plugin deployment easier and more standardized – at the moment we use standard phing build system to automatically upload and configure a plugin server. Soon developers will be able to append plugin javascript part to a clients’ “plugin box”. Taking all aspects into consideration, the SDK should considerably improve plugin management and sooner or later will lead to fully automatized plugin management.

Background

Almost 1/3 of plugins’ code is always the same. Writing it all over again makes process error-prone and time-consuming. So, we collected the best parts of the plugins and put them together to solve the problem. What common parts did we find? Every plugin uses a logger, so we implemented the PSR-3 logger with configurable parameters. A Configuration Manager with environment detection. The API Wrapper – a collection of methods and arguments easily callable with standard method chaining technique.

Filesystem API, Storage, Dependency Container, HTTP client – to make SDK and plugins testable. Implementing all features with one day is impossible,  so we started adding functions while developing plugins. One day we cover the reasonable amount of the API and developers can develop plugins without looking the API documentation.

Philosophy

Every plugin must:

  • be 100% tested.
  • use SDK functionality and follow structure principles, business logic is the only exception.

Why it is so important?

  • Plugins developed with SDK are easily testable.
  • Provides already tested components which most certainly work.
  • Removes some of the security issues.
  • Boilerplate code is already written and folder structure is set up.
  • It makes plugins maintainable.
  • We can change thousands of plugins with new SDK version if Erply API or plugin hosting changes. (or if we find a bug).
  • All developers must follow the same coding style and pattern. – Every developer has the same idea of “plugin” and “plugin deployment”.
  • One click development environment setup.
  • Best practices are already used.
  • The API methods/parameters autocomplete using PHPStorm or similar IDE.
  • Possibility to implement migration script for thousands of plugins.

What plugin development looks like?

  1. A developer clones existing plugin-skeleton repository.

/plugin-root

/bin – executable scripts

/config – configuration files

/tmp – temporary files

/library  – plugin classes

/public – publicly available files

/tests – test files

  1. The Developer writes code and tests all files in the library folder.
  2. Deploys prototype version to a server with one click.

Contact our support to get started with the Erply Plugin SDK.