Terminologies

This module uses the same concepts and terminologies used in the Drupal 7 purl module.

1. Modifiers

In the heart of what this module does are modifiers. A modifier is simply a string that maps to an arbitrary value.

For example, we can have the following modifiers that maps to certain values:

Modifier Value
foo 1
bar "baz"
fizz ["b", "u", "z", "z" ]

For the Drupal 8 version of the purl module, we have architected the modifier index to allow for non-scalar values, like arrays or objects. The only requirement is that the value can be serialized and deserialized with unserialize(...) and deserialize(...)

2. Methods

A method is a distinction used to signify the portion of the request URL that a modifier string can appear in.

There are multiple types of methods:

Method type Example Modifier Implemented?
Subdomain http://foo.drupalsite.io foo yes
Path prefix http://drupalsite.io/bar/node/1 bar yes
Domain http://drupalsite.io/admin drupalsite.io no
Query http://drupalsite.io/content/bar?fizz=1 fizz no

Methods types are managed as plugins, which means you can register a custom method plugin in your module that will suit your specific needs.

3. PURL Providers

A PURL provider is responsible for declaring what modifiers are available in the system. The purl module will check the current request against its index of known modifiers to see which ones are present in the current request.

You will most likely need to write a PURL provider if you are planning to use this module.