Labrador core tutorials

Getting Started

Getting started with Labrador should be simple out-of-the-box. Extend the AbstractApplication class and implement the AbstractApplication::doStart method. This method should return a Amp\Promise that resolves when your app has finished running. If you've already read the Quick Start on the README some code below may look familiar to you. However, there are some important additions in this documentation compared to the README so review the code carefully.

Plugins: Overview

Plugins are discrete, reusable pieces of functionality that can be easily utilized by any number of Labrador Applications. There are a variety of built-in Plugin interfaces that, when implemented, allow you to easily hook into the operations of a Labrador Application. In addition, it is possible to fully customize the Plugin loading process with your own Plugin types... meaning it would be easy for you to come up with your own Plugin and have it hook into Labrador.

Plugins: Registering Services

We anticipate registering services on to the Auryn\Injector being one of the most common use cases for Plugins. Labrador highly encourages libraries to be built that can work with any Amp project. The InjectorAwarePlugin is simply some minimal glue to put your functionality into Labrador's ecosystem.

Plugins: Handling Events

Labrador emits semantic, data-rich events throughout the processing of an application to ensure that you can respond to meaningful occurrences while being decoupled from the code doing the actual processing. The Labrador async-eventlibrary provides the functionality that emits events and allows you to attach listeners that respond to those events. This library allows for listeners to be processed in an async context and provides a wealth of functionality for working in async applications.

Plugins: Booting Up

Sometimes your Plugin might need to do something one time during the Plugin loading process. This is where the BootablePlugin interface comes into play. Implementing this interface ensures that your Plugin has an opportunity to complete its task after all other Plugin loading procedures have finished.

Plugins: Depending on other Plugins

Sometimes you need to rely on a service provided by another Plugin or need to ensure that Plugin has done some other thing before your Plugin will work correctly. Implementing the PluginDependentPlugin will ensure that any other Plugins you depend on will be loaded first.