diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 141686f..e057a11 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -5,8 +5,13 @@
  * Contains Drupal.
  */
 
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
 use Drupal\Core\Url;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Static Service Container wrapper.
@@ -628,4 +633,45 @@ public static function accessManager() {
     return static::$container->get('access_manager');
   }
 
+  /**
+   * Provides the default Drupal front controller functionality.
+   *
+   * @param $class_loader
+   *   The class loader. Normally Composer's ClassLoader, as included in
+   *   index.php, but may also be decorated; e.g.,
+   *   \Symfony\Component\ClassLoader\ApcClassLoader.
+   *
+   * @throws \Exception
+   *   Any exception thrown whilst handling the request and not caught already
+   *   is rethrown by this method after adding a message to help the user
+   *   recover.
+   */
+  public static function frontController($class_loader) {
+    try {
+      $request = Request::createFromGlobals();
+      $kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod');
+      $response = $kernel
+        ->handle($request)
+        // Handle the response object.
+        ->prepare($request)->send();
+      $kernel->terminate($request, $response);
+    }
+    catch (HttpExceptionInterface $e) {
+      $response = new Response('', $e->getStatusCode());
+      $response->prepare($request)->send();
+    }
+    catch (Exception $e) {
+      $message = 'If you have just changed code (for example deployed a new module or moved an existing one) read <a href="http://drupal.org/documentation/rebuild">http://drupal.org/documentation/rebuild</a>';
+      if (Settings::get('rebuild_access', FALSE)) {
+        $rebuild_path = $GLOBALS['base_url'] . '/rebuild.php';
+        $message .= " or run the <a href=\"$rebuild_path\">rebuild script</a>";
+      }
+
+      // Set the response code manually. Otherwise, this response will default
+      // to a 200.
+      http_response_code(500);
+      print $message;
+      throw $e;
+    }
+  }
 }
diff --git a/index.php b/index.php
index 55fc947..b6a9935 100644
--- a/index.php
+++ b/index.php
@@ -8,38 +8,5 @@
  * See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
  */
 
-use Drupal\Core\DrupalKernel;
-use Drupal\Core\Site\Settings;
-use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\Response;
-
 $autoloader = require_once __DIR__ . '/core/vendor/autoload.php';
-
-try {
-
-  $request = Request::createFromGlobals();
-  $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
-  $response = $kernel
-      ->handle($request)
-      // Handle the response object.
-      ->prepare($request)->send();
-  $kernel->terminate($request, $response);
-}
-catch (HttpExceptionInterface $e) {
-  $response = new Response('', $e->getStatusCode());
-  $response->prepare($request)->send();
-}
-catch (Exception $e) {
-  $message = 'If you have just changed code (for example deployed a new module or moved an existing one) read <a href="http://drupal.org/documentation/rebuild">http://drupal.org/documentation/rebuild</a>';
-  if (Settings::get('rebuild_access', FALSE)) {
-    $rebuild_path = $GLOBALS['base_url'] . '/rebuild.php';
-    $message .= " or run the <a href=\"$rebuild_path\">rebuild script</a>";
-  }
-
-  // Set the response code manually. Otherwise, this response will default to a
-  // 200.
-  http_response_code(500);
-  print $message;
-  throw $e;
-}
+\Drupal::frontController($autoloader);
