The ModularRouting component maps similar requests to different sets of configuration values based on a customizable routing process.

The main driver of this component is the ModularRouter class, an implementation of Symfony's RouterInterface. The ModularRouter class uses a custom matching process to load a different set of routing metadata based on the conditions of a request. To determine which set of metadata matches the request, ModularRouter relies on an instance of ProviderInterface to map the request to a Module and load the metadata associated with it.


This documentation is about the Harmony routing implementation. If you're not familiar with routing in Symfony we recommend reading the relevant Symfony documentation first. If you're interested in using this component with the Symfony framework check out the Symfony Integration section of this page.

Take a look at the ChainRouter class of the Symfony CMF Routing component to chain multiple routers together.


Every website has a different content strategy. In some cases the content is pre-determined during development while in other cases content should be easily replaceable using an administration interface. The ModularRouting component offers a mix of both approaches by allowing pre-defined routes to be contained within a module. Every module has a type which is associated with a set of metadata. If a set of metadata was found, the router only uses this metadata to match the request.


This component is available as a package in Composer (harmony-project/modular-routing on Packagist) or can be downloaded from the official Git repository on GitHub.

Read the Getting started section for more information on how to use the component.

Symfony Integration

To use the ModularRouting component with your Symfony project, we created an integration bundle. More information can be found in the ModularBundle documentation.


Getting started

Defining metadata

Associating modules with entities

Creating a custom provider

This page was last updated on 09 Jul 2017, at 19:01.