Skip to content

Instantly share code, notes, and snippets.

@rsanchez
Created November 5, 2019 16:24
Show Gist options
  • Save rsanchez/96d4b902d03a621709d181bf984c25fc to your computer and use it in GitHub Desktop.
Save rsanchez/96d4b902d03a621709d181bf984c25fc to your computer and use it in GitHub Desktop.
Bootstrap Craft 3 for Psysh
<?php
/**
* Craft console bootstrap file
*/
// Set path constants
define('CRAFT_BASE_PATH', __DIR__);
define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH . '/vendor');
// Load Composer's autoloader
require_once CRAFT_VENDOR_PATH . '/autoload.php';
// Load dotenv?
if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH . '/.env')) {
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load();
}
// Load and run Craft
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production');
$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/console.php';
return [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment