The current_path() is replaced by the <current> route. In case you want to link to the current page, use the <current> url object:
$url = Url::fromRoute('<current>');
\Drupal::l('title', $url);
Instead of comparing current_path(), compare the current route:
\Drupal::routeMatch()->getRouteName() == 'composer_manager.settings'
In case you need the path, call toString() on the $url object:
$url = Url::fromRoute('<current>');
$url->toString();
as current_path() was in D7 [updated 03.28.2016]
$current_path = \Drupal::service('path.current')->getPath();
Together with this change, it is now impossible to set $element['#ajax']['path'], you must set $element['#ajax']['url'] instead, which accepts a \Drupal\Core\Url object.
Finally, for JavaScript code: drupalSettings.path.basePath doesn't exist anymore and was replaced with drupalSettings.path.baseUrl. However, 99% of the time you don't want to use those settings anyway, use Drupal.url() instead!
Comments
This also the correct
This also the correct replacement for
request_path().