Phel includes a series of commands out-of-the-box.
# To see an overview of all commands.
Build the project#
# Usage:
# build [options]
#
# Options:
# --cache|--no-cache Enable cache
# --source-map|--no-source-map Enable source maps
Build the current project into the main php path. This means that the compiled phel code into PHP will be saved in that directory being the entry point the out/index.php, and you can run the PHP code directly using the PHP interpreter. This will improve the runtime performance, because there won't be a need to compile the code again.
Configuration in phel-config.php:
Export definitions#
Export all definitions with the metadata {:export true} as PHP classes.
It generates PHP classes at namespace level and a method for each exported definition. This allows you to use the exported phel functions from your PHP code.
Configuration in phel-config.php:
Format phel files#
Formats the given files. You can pass relative or absolute paths.
# Usage:
# format <paths>...
#
# Arguments:
# paths The file paths that you want to format.
Configuration in phel-config.php:
Read-Eval-Print Loop#
Start a Repl. This is and interactive prompt (stands for Read-eval-print loop). It is very helpful to test out small tasks or to play around with the language itself.
Read more about the REPL in its own chapter.
Run a script#
Code can be executed from the command line by calling the run command, followed by the file path or namespace:
# Usage:
# run [options] [--] <path> [<argv>...]
#
# Arguments:
# path The file path that you want to run.
# argv Optional arguments
#
# Options:
# -t, --with-time With time awareness
Configuration in phel-config.php:
Read more about running the code in the getting started page.
Test your phel logic#
Tests the given files. If no filenames are provided all tests in the "tests" directory are executed.
# Usage:
# test [options] [--] [<paths>...]
#
# Arguments:
# paths The file paths that you want to test.
#
# Options:
# -f, --filter[=FILTER] Filter by test names.
# --testdox Report test execution progress in TestDox format.
Configuration in phel-config.php:
Use the filter option to run only the tests that contain that filter.
Configuration in phel-config.php: