Skip to content

Instantly share code, notes, and snippets.

@colinmollenhour
Forked from Vinai/boris-mage.php
Last active December 17, 2015 08:19
Show Gist options
  • Save colinmollenhour/5579361 to your computer and use it in GitHub Desktop.
Save colinmollenhour/5579361 to your computer and use it in GitHub Desktop.
Search for boris in PHP default include path and Magento's lib directory.
#!/usr/bin/env php
<?php
//
// PHP REPL with initialized Magento environment
//
// Thanks to https://github.com/d11wtq/boris
//
// Run this script anywhere in the Magento directory tree to start the REPL
//
$mageFile = 'app/Mage.php';
for ($i = 0, $d = './'; ! file_exists($d.$mageFile) && ++$i < 25; $d .= '../');
if (! file_exists($d.$mageFile)) {
echo "Unable to find $mageFile" . PHP_EOL;
exit(2);
}
chdir($d); // Magento needs the pwd to be the magento base dir
set_include_path(get_include_path().':'.getcwd().'/lib');
require_once 'boris/lib/autoload.php';
umask(0);
require_once $mageFile;
Mage::setIsDeveloperMode(true);
Mage::app('admin');
$boris = new \Boris\Boris('mage> ');
$boris->start();
@Vinai
Copy link

Vinai commented May 15, 2013

Good idea, I manually pulled the change over to https://gist.github.com/Vinai/5579309 - thanks!

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