The shell includes readline support with tab-completion and history. To start the shell, simply run this script from your command line. Use ctl-d to exit the shell, or enter the command "exit".
Exemplo n.º 1
0
    public static function main($options = array())
    {
        $shell = new iphp($options);
        print <<<END

Welcome to the PHOCOA shell! The PHOCOA shell is a powerful interactive PHP shell for allowing you to experiment with your application interactively.

Features include:
- autocomplete (tab key)
- readline support w/history
- automatically wired into your project's autoload

Enter a php statement at the prompt, and it will be evaluated. The variable \$_ will contain the result.

Example:

> new WFArray(array(1,2))
Array:
  0 => 1
  1 => 2
END Array

> \$_[0] + 1
2


END;
        // readline history
        if (function_exists('readline_read_history')) {
            readline_read_history($shell->historyFile());
            // doesn't seem to work, even though readline_list_history() shows the read items!
        }
        // install tab-complete
        if (function_exists('readline_completion_function')) {
            readline_completion_function(array($shell, 'readlineCompleter'));
        }
        while (true) {
            $shell->doCommand($shell->readline());
        }
    }
Exemplo n.º 2
0
 public static function main($options = array())
 {
     $shell = new iphp($options);
     $shell->runREPL();
 }
Exemplo n.º 3
0
 /**
  * @param string $syntax - PHP code string to tokenize
  */
 public function __construct($syntax)
 {
     $this->syntax = $syntax;
     $this->process();
     $this->phpCommand = iphp::PHPExecutableLocation();
 }
Exemplo n.º 4
0
<?php

ini_set("memory_limit", '200M');
$conf = getenv('PHOCOA_PROJECT_CONF');
$tags = basename($conf) . '/../tags';
// bootstrap phocoa for iphp shell
require_once $conf;
require_once 'framework/util/iphp.php';
iphp::main(array('tags' => $tags, 'require' => $conf));
Exemplo n.º 5
0
<?php

# This file is part of the Akelos Framework
# (Copyright) 2004-2010 Bermi Ferrer bermi a t bermilabs com
# See LICENSE and CREDITS for details
if (defined('AK_CONSOLE_MODE')) {
    require_once AK_ACTIVE_SUPPORT_DIR . DS . 'base.php';
    require_once AK_CONTRIB_DIR . DS . 'iphp' . DS . 'iphp.php';
    iphp::main(array('require' => __FILE__, 'prompt_header' => "Akelos PHP Framework iphp console\n"));
} else {
    define('AK_CONSOLE_MODE', true);
    defined('DS') || define('DS', DIRECTORY_SEPARATOR);
    defined('AK_BASE_DIR') || define('AK_BASE_DIR', str_replace(DS . 'akelos' . DS . 'active_support' . DS . 'utils' . DS . 'scripts' . DS . 'console.php', '', __FILE__));
    $_app_config_file = AK_BASE_DIR . DS . 'config' . DS . 'config.php';
    if (file_exists($_app_config_file)) {
        include AK_BASE_DIR . DS . 'config' . DS . 'config.php';
    } else {
        include AK_BASE_DIR . DS . 'test' . DS . 'shared' . DS . 'config' . DS . 'config.php';
    }
    defined('AK_ENVIRONMENT') || define('AK_ENVIRONMENT', 'testing');
    require_once AK_ACTIVE_SUPPORT_DIR . DS . 'base.php';
}