drupal_goto() replacements in Drupal 8

drupal_goto() has been removed in Drupal 8. To spply a internal or external redirect there are several options.

Internal redirect

<?php
use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase {

  public function myMethod() {
    return $this->redirect('user.page');
  }
}

External redirect

The RedirectResponse object doesn't allow external URLs. Here the TrustedRedirectResponse class comes in.
 
<?php
use Drupal\Core\Routing\TrustedRedirectResponse;

class MyController extends ControllerBase {

  public function myController() {
    return new TrustedRedirectResponse('http://website.com/foo/bar/');
  }
}
 
When not in Controller scope you can do this: 
<?php
use Symfony\Component\HttpFoundation\RedirectResponse;

function some_function() {
  return new RedirectResponse(\Drupal::url('user.page'));
}

Redirecting internally with query parameters

<?php
use Drupal\Core\Controller\ControllerBase;

class MyController extends ControllerBase {

  public function myMethod() {
    return $this->redirect('entity.node.canonical', ['node' => 64, 'other_param' => 'value']);
  }
}