API changes in Drupal 8 in comparison to Drupal 7

This post would reflect on few essential APIs in Drupal 7 and how they were changed in Drupal 8:

drupal_get_title(): Gets the title of the current page. Link to changelog here .
Drupal 7:

<?php
  $title
= drupal_get_title();
?>

Drupal 8:

<?php
  $request
= \Drupal::request();
 
$route_match = \Drupal::routeMatch();
 
$title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
?>

--
Links:
https://www.drupal.org/node/2067859

Technologies: