The Modular Routing component comes with a number of loader classes, each giving you the ability to load a collection of metadata defintions from an external file of some format. Each loader expects a FileLocator instance as the constructor argument. You can use the FileLocator instance to define an array of paths in which the loader will look for the requested files. If the file is found, the loader returns an array of metadata definitions that the MetadataFactory will convert into ModuleMetadata objects.

These are the loaders available in this component under the Harmony\Component\ModularRouting\Metadata\Loader namespace:

These are some examples of module definitions to be used with the loaders:


<!-- modular_routing.xml -->
<?xml version="1.0" encoding="UTF-8" ?>

  <module id="module_foo" name="Foo Module" type="acme_foo">
    <resource type="xml">app/config/routing/foo.xml</resource>
  <module id="module_bar" name="Bar Module" type="acme_bar">
    <resource type="xml">app/config/routing/bar.xml</resource>


# modular_routing.yml
    name: "Foo Module"
    type: "acme_foo"
        - { resource: "app/config/routing/foo.yml", type: "yaml" }

    name: "Bar Module"
    type: "acme_bar"
        - { resource: "app/config/routing/bar.yml", type: "yaml" }

This page was last updated on 14 May 2017, at 02:39.