Skip to content

Site Alias Manager

The Site Alias Manager (SAM) service is used to retrieve information about one or all of the site aliases for the current installation.

  • An informative example is the browse command
  • A commandfile gets usually access to the SAM via autowire of a dependency:
    #[Autowire(service: DependencyInjection::SITE_ALIAS_MANAGER)]
    private readonly SiteAliasManagerInterface $siteAliasManager
    
  • If an alias was used for the current request, it is available via $this->siteAliasManager->getself().
  • The SAM generally deals in SiteAlias objects. That is how any given site alias is represented. See its methods for determining things like whether the alias points to a local host or remote host.
  • Site alias docs.
  • Dynamically alter site aliases.
  • The SAM is also available for as a standalone Composer project. More information available in the README there.

Last update: March 9, 2024