Alias generator

Toolkit provides an flexible, configurable alias generator which is able to creates unique aliases in different formats.

Filter based alias generator

The core of this tool is a filter based alias generator. It implements the alias generator interface and uses a set of filters to generate the alias. It uses a validator to ensure a valid alias is generated.


  • Different alias generation strategies
  • Combining multiple columns
  • Customizable separator string

Provided filters

All provided filters have different strategies to modify an alias value. They can combine strings or just return a simple value.

This filter just passes the existing alias value. Usually it should be the first filter in the chain. If you always want to recreate an alias just don’t use this filter.
This filter uses the alias values
Generates a standardized value like Contao standardize helper function does.
This filter adds a numeric suffix which is count until an valid alias is generated.

Provided validators

This validator checks the database if an unique value exists. It only has a global scope which means the unique value has to be unique in the whole data set.

Default factory

Toolkit has a default factory which creates an alias generator which has the default behaviour how Contao generates alias:

  1. Only create alias value if field is empty
  2. standardize the value
  3. Add suffix value
// Default alias generator factory is provided as service with service id:
// ""

/** @var \Netzmacht\Contao\Toolkit\Data\Alias\Factory\AliasGeneratorFactory $factory */
$aliasGenerator = $factory->create('my_table', 'alias_field', ['value', 'fields']);

Alias Generator callback

Toolkit also provides an alias generator callback. See Callbacks for it.