Skip to content

Instantly share code, notes, and snippets.

@tobyontour
Created August 9, 2020 12:51
Show Gist options
  • Select an option

  • Save tobyontour/dc3fef82fa0c0c0c6d2c7380829be660 to your computer and use it in GitHub Desktop.

Select an option

Save tobyontour/dc3fef82fa0c0c0c6d2c7380829be660 to your computer and use it in GitHub Desktop.
Drupal index.php to spit out route name.
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$kernel = new DrupalKernel('prod', $autoloader);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
error_log(\Drupal::routeMatch()->getRouteName());
$response->send();
$kernel->terminate($request, $response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment