1// Get node from path alias.
2$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias');
3
4if(preg_match('/node\/(\d+)/', $path, $matches)) {
5 $node = \Drupal\node\Entity\Node::load($matches[1]);
6}
7
8// Path alias manager service has been change to 'path_alias.manager' on later version.
9$path = \Drupal::service('path_alias.manager')->getPathByAlias('/this-is-the-alias');