Drupal 8 Check is front page with alias

Drupal 8 Check is front page with alias
$current_path = \Drupal::service('path.current')->getPath();
$front_uri = Drupal::config('system.site')->get('page.front');
$front_alias = \Drupal::service('path.alias_manager')->getAliasByPath($front_uri);
$current_alias = \Drupal::service('path.alias_manager')->getAliasByPath($current_path);
$isFrontPage = \Drupal::service('path.matcher')->isFrontPage() || $front_alias === $current_alias;

Other posts