The optional prado-cli.php PHP script file in the framework directory provides command line tools to perform various tedious takes in Prado. The prado-cli.php can be used to create Prado project skeletons, create initial test fixtures, and access to an interactive PHP shell.
To use the command line tool, you need to use your command prompt, command console or terminal. In addition, PHP must be able to execute PHP scripts from the command line.
If you type php path/to/framework/prado-cli.php, you should see the following information. Alternatively, if you are not on Windows, you may try to change the prado-cli.php into an executable and execute it as a script
The <parameter> are required parameters and [optional] are optional parameters.
To create a Prado project skeleton, do the following:
The interactive shell allows you to evaluate PHP statements from the command line. The prado-cli.php script can be used to start the shell and load an existing Prado project. For example, let us load the blog demo project. Assume that your command line is in the prado distribution directory and you type.
In the blog demo project, we need to create two Active Record classes, UserRecord and PostRecord, to represent data records in the users and posts tables, respectively. Active Record classes must extend from the base class ActiveRecord, and must define property names that matches with the field names of the corresponding table.
To better organize our directories, we create a new directory protected/database to hold the class files. We also modify our application configuration by inserting the following lines. It is equivalent to adding the directory protected/database to PHP include_path, which allows us to use the classes without explicitly including them.
At the prompt, enter the following two commands to create UserRecord and PostRecord classes:
Here we used the namespace format again to specify the classes to be created. The path Application.database.UserRecord indicates that we want the UserRecord class file to be protected/database/UserRecord.php.