<commit_before># The PHP REPL

This project contains (among other things) a [read-eval-print loop](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) (REPL) for the PHP language.

### Features

1. Executes expressions in the global scope so global variables are accessible.
2. Requires no local or global variables, so there is no chance that it will
   clobber anything.
3. Handles all types of errors and exceptions: the REPL does not die on fatal
   errors, for example.
4. Can be configured via .htaccess files.
5. History support via readline.
6. Tab completion for everything.
7. Optional colored output.
8. Can be extended easily.

### Caveats

The REPL was designed to work with the [Wigwam classloader](https://github.com/micha/wigwam/blob/master/ClassLoader.php). The `-p` command line option allows the inclusion of other
classloaders prior to loading the Wigwam classloader, but tab-completion may
not work for those classes. Once the class has been loaded, however, tab
completion should work fine.

**Note:** Files included via the `-p` option do not run in the global scope.

### Install

Assuming _/usr/local/lib/php_ is in your PHP include path, and _/usr/local/bin_
is in your shell path, I'd do something like this:

```bash
$ cd /usr/local/lib/php
$ git clone git://github.com/micha/wigwam.git Wigwam
$ cd Wigwam/Console
$ ln -s `pwd`/console /usr/local/bin/console
```

### Usage

```
Usage: console [OPTIONS]

Where OPTIONS are:

  -c <color>    Return value print color (default is "cyan"). Choices are:
                [black, red, green, yellow, blue, magenta, cyan, white, none]
                Choose "none" to disable colored output.
  -f <file>     Require <file> before starting REPL.
  -h            Print usage info and exit.
  -H            Don't parse .htaccess files at startup.
  -i <var=val>  Set PHP configuration option "var" to "val".
  -j <prefix>   Prefix for PHP history globals (default is "_").
  -J            Disable PHP history globals.
  -p <file>     Require <file> before loading console's classloader.
  -q            Don't echo the result after evaling each expression.<commit_msg>fix incorrect install instructions<commit_after># The PHP REPL

This project contains (among other things) a [read-eval-print loop](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) (REPL) for the PHP language.

### Features

1. Executes expressions in the global scope so global variables are accessible.
2. Requires no local or global variables, so there is no chance that it will
   clobber anything.
3. Handles all types of errors and exceptions: the REPL does not die on fatal
   errors, for example.
4. Can be configured via .htaccess files.
5. History support via readline.
6. Tab completion for everything.
7. Optional colored output.
8. Can be extended easily.

### Caveats

The REPL was designed to work with the [Wigwam classloader](https://github.com/micha/wigwam/blob/master/ClassLoader.php). The `-p` command line option allows the inclusion of other
classloaders prior to loading the Wigwam classloader, but tab-completion may
not work for those classes. Once the class has been loaded, however, tab
completion should work fine.

**Note:** Files included via the `-p` option do not run in the global scope.

### Install

Assuming _/usr/local/lib/php_ is in your PHP include path, and _/usr/local/bin_
is in your shell path, I'd do something like this:

```bash
$ cd /usr/local/lib/php
$ git clone git://github.com/micha/wigwam.git Wigwam
$ cd Wigwam
$ ln -s `pwd`/console /usr/local/bin/console
```

### Usage

```
Usage: console [OPTIONS]

Where OPTIONS are:

  -c <color>    Return value print color (default is "cyan"). Choices are:
                [black, red, green, yellow, blue, magenta, cyan, white, none]
                Choose "none" to disable colored output.
  -f <file>     Require <file> before starting REPL.
  -h            Print usage info and exit.
  -H            Don't parse .htaccess files at startup.
  -i <var=val>  Set PHP configuration option "var" to "val".
  -j <prefix>   Prefix for PHP history globals (default is "_").
  -J            Disable PHP history globals.
  -p <file>     Require <file> before loading console's classloader.
  -q            Don't echo the result after evaling each expression.
{'fraction_non_alphanumeric': 0.09436587062369581, 'fraction_numerical': 0.008346858335265477, 'mean_word_length': 3.2670623145400595, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2667499', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1272, 'n_words': 564}