Chapter: Using jelix scripts
|« Core workflow||^ Main concepts||Creating an application »|
Using jelix.php ¶
Jelix provides a CLI script,
lib/jelix-scripts/jelix.php. it allows you to execute commands in your application context. Particularly, you are able to create and modify some files easily and automatically.
This script must be invoked with the command line version of PHP. So, open a console and go to
cd lib/jelix-scripts/ # under linux cd lib\jelix-scripts\ # under windows
Then, type this kind of command line:
# under windows > php.exe jelix.php [--application_name] command_name [options] [parameters] # under linux $ php jelix.php [--application_name] command_name [options] [parameters]
You should always call
jelix.php with a "jelix command" name, and optionally some options and/or parameters.
First, you access help on all available commands with the
php jelix.php help
Another generic parameter you have to indicate for most of jelix commands : your application name. This is always the first parameter of
jelix.php, and it must be preceded by
php jelix.php --myapp createapp
Alternatively, you can avoid typing your application name by setting an environment variable: JELIX_APP_NAME. For example, type this in the console:
export JELIX_APP_NAME="myapp" # under linux set JELIX_APP_NAME=myapp # under windows
Then you can type any command without
php jelix.php createapp
Notice that you can execute the script from any directory. For example, you can type:
php jelix/path/lib/jelix-scripts/jelix.php --myapp createapp
Changing the default configuration ¶
Commands creating new files or directories follow a specific tree structure. Perhaps you may want to organize your files in a different manner. Also, there are some customizable infos stored in header comments of files, like your name, the project name and so on.
You can configure all of this by creating a configuration file for jelix.php CLI script.
lib/jelix-scripts/, there is a file
scripts.conf.php.dist. Rename it to
scripts.conf.php, and modify its settings by changing the different values.
You can also create another file, in any other directory, (to have different configuration for each projects for example). If you do so, just indicate its path in JELIX_CONFIG environment variable.