src/Container.php
public function alias(string $key, string $targetKey) : AliasDefinition
    {
        return $this->items[$key] = new AliasDefinition($targetKey);
    }
public function alias(string $key, string $targetKey) : AliasDefinition
    {
        return $this->items[$key] = new AliasDefinition($targetKey);
    }
public function alias ( string $ key , string $ targetKey ) : AliasDefinition { return $ this -> items [ $ key ] = new AliasDefinition ( $ targetKey ) ; }
Creates an alias from one key to another.

This method can be used for use cases as simple as:

$container->alias('my.alias', 'my.service');

This is particularly useful when you have already registered a class by its name,
but now want to make it resolvable through an interface name it implements as well:

$container->bind('Class\Name');
$container->alias('Interface\Name', 'Class\Name');

An alias always queries the current value by default, unless you change its scope,
which may be used for advanced use cases, such as creating singletons out of a prototype:

$container->bind('Class\Name')->in(new Scope\Prototype());
$container->alias('my.shared.instance', 'Class\Name')->in(new Scope\Singleton());

@param string $key       The key, class or interface name.
@param string $targetKey The target key.

@return \Brick\Di\Definition\AliasDefinition
Creates an alias from one key to another .