The Plugin System in Amfphp

Amfphp has a system to allow developers to extend the core functionality. It is based around 2 concepts, neither of which are unique to Amfphp, but that have been adapted to the needs of the project. These 2 concepts are « plugins » and « filters ».

Plugins are the extensions themselves. The system is designed so that they are easy to add, remove and configure.

– To add a plugin, copy its folder to the plugins folder of Amfphp. This is by default in Amfphp/Plugins, but can be changed in the configuration.

– To configure a plugin, use the pluginsConfig array in the configuration.

– To remove a plugin, delete it from the plugins folder.

Finally it is also possible to disable a plugin without removing it. You can learn more about these subjects in the configuration section.

Filters are the mechanism that is used by Amfphp to allow plugins to interact with it. The idea is that at several moments in the processing Amfphp allows plugins to access and to modify objects that pertain to the process. This is called filtering. For example, before processing the raw data contained in a request, Amfphp has a filter allowing plugins to filter it. This allows a logging plugin to save the data. Another example is that a plugin can override the default deserializer and deserialize a request itself. Filters in Amfphp are designed with a balance between functionality, ease of use and performance, in that order of priority.

Amfphp comes with some plugins already installed. Take a look in the Amfphp/Plugins folder to see what they are. 3rd party developers are encouraged to create plugins for Amfphp as we feel they add value to the platform.

Laissez un commentaire

News letter

Evénements Silex Labs sur Paris et sa région: Inscrivez vous à la Newsletter mensuelle

Silex Labs community Tweets

Facebook page