Skip to content

Instantly share code, notes, and snippets.

@jibran
Created February 21, 2017 04:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jibran/2ba1cf5105487599f38f0a98286b20a8 to your computer and use it in GitHub Desktop.
Save jibran/2ba1cf5105487599f38f0a98286b20a8 to your computer and use it in GitHub Desktop.
Drupal minimal bootstrap.
<?php
/**
* @file
* Drupal minimal bootstrap.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
$kernel->loadLegacyIncludes();
$kernel->boot();
// Drupal code here.
@jibran
Copy link
Author

jibran commented Dec 2, 2019

<?php
// test.php
/**
 * @file
 * Drupal full bootstrap with modules.
 */
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once 'autoload.php';
$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', TRUE, __DIR__);
$kernel->boot();
$kernel->preHandle($request);

@iamxwk
Copy link

iamxwk commented Apr 8, 2021

good !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment