Created
November 5, 2019 16:24
-
-
Save rsanchez/96d4b902d03a621709d181bf984c25fc to your computer and use it in GitHub Desktop.
Bootstrap Craft 3 for Psysh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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