Modules

The OSM Aviation Portal is heading towards a modular architechture where we'll utilize the power of Composer packages and the ease of Laravel's auto-discovery.

Modules will provide everything needed to run them.

We're separating modules into modules and tools. Tools contain tools that developers can use in their modules. An example of a tool is bulk-actions.

Building modules

Modules should be based off of the module-skeleton repository. This contains everything necessary to get your module up and running. The main thing to notice is the use of the ModuleServiceProvider which takes care of "everything" needed to register your module into Laravel. Please read the docs for the module package to learn this.

Local development

While Composer does offer local repositories it isn't really convenient when you need your packages "pushable" to production. This is why we're using a custom Composer plugin which runs through the install process, and then symlinks the local repository, so that the composer.lock file is valid on other machines.

You'll install it as a global package:

composer global require tormjens/workbench

You can read more about setting it up on the Github page.

Naming

Modules should follow a naming scheme. It is encouraged that you name your module something unique that both describes its function and is catchy. The catchy part is optional. If you're creating a module called campaigns, then the repository should be called campaigns-module and the name of the package would be osmaviation/campaigns. Likewise, if you're building a tool called foo, then the repo would be named foo-tool and the package name osmaviation/foo.

Distribution

We've configured a Satis instance which helps us distribute our package. You'll get credentials for this from your manager. The workflow has been configured so that the Satis repository is updated every time a push is made to any repository that ends in -module or -tool. The same also occurs if a repository has been added manually. The package is automatically added to the repository if the above criteria is met as well.

Using the repository

We recommend you add the repository to your ~/.composer/config.json file. This way you'll only have to think of this once.

{
    "config": [],
    "repositories": {
        "osmaviation": {
            "type": "composer",
            "url": "https://*****:*****@composer.osmaviation.io"
        }
    }
}