Each section below comes from the definition of the command, and crest <command> --help shows the same text in the terminal. Run crest with no arguments, or crest list, for the list of the commands. In a project, the list shows only the commands for the flavor of the project (see Overview). crest --help shows the help of list, because crest with no command runs list. An unknown option with no command, or a crest.php that is not valid, stops the listing with an error.
about
Show environment and version information
crest about [options]Shows the environment and version report. In a project, a global crest gives this command to the crest of the project (vendor/bin/crest), with the same arguments.
crest aboutAliases: info, i. See The global Crest and the project Crest.
config:show
Show the resolved project configuration
crest config:show [options]Shows the configuration that crest resolved for the project, and where each value comes from: declared in crest.php, or the default. It does not start the front controller of the project.
crest config:showAliases: none. Flavors: ADR, MVC. See Configuration.
container:list
List the services registered in the container
crest container:list [options]Lists the services that the application registers in its container. This command boots the project: it starts the front controller that the bootstrap key of crest.php names.
crest container:listAliases: none. Flavors: ADR. See Commands that Boot the Project.
down
Stop and remove the project containers
crest down [options]Stops and removes the containers of the project with docker compose. Run it with a crest outside the vendor folder of the project, for example the global crest or the launcher ./crest.
| Option | Description |
|---|---|
--volumes |
Remove the named volumes too |
crest down
crest down --volumes # also remove the named volumesAliases: none. See Running a Project.
event:list
List the listeners attached to the events manager
crest event:list [options]Lists the listeners that the application attaches to its events manager. This command boots the project: it starts the front controller that the bootstrap key of crest.php names.
crest event:listAliases: none. Flavors: ADR. See Commands that Boot the Project.
init
Write crest.php for an existing project
crest init [options]Writes crest.php for a project that exists. The project needs a psr-4 entry in composer.json.
It asks for the namespace, the flavor, the front controller, the folders, the runtime and the database, and proposes a value that it finds in the project. --no-interaction accepts all the proposals.
| Option | Description |
|---|---|
--flavor=<value> |
The flavor of the project: mvc or adr. Default: what init finds |
--database=<value> |
Add a database: none, mariadb, mysql, pgsql or sqlite. Default: none |
--force |
Overwrite an existing crest.php, and DbProvider with --database |
crest init
crest init --database=mysql # also add a MySQL database
crest init --flavor=adr --force # overwrite crest.phpAliases: none. See Adding Crest to an Existing Project.
install
Install composer dependencies in the project container
crest install [options]Installs the composer dependencies of the project in its container. Run it after up, with a crest outside the vendor folder of the project, for example the global crest or the launcher ./crest.
crest installAliases: none. See Running a Project.
list
List the available commands
crest list [options]Lists the available commands. In a project, it shows only the commands for the flavor of the project. A run of crest with no command runs list.
crest listAliases: commands, enumerate.
make:action
Create an ADR action for a route
crest make:action <method> <path> [options]Creates an ADR action for an HTTP method and a route path. The router of the framework gives the class name and the folder: each part of the path is a namespace part, and placeholders are not part of the name. Placeholders, for example {id}, must come last.
A view action names a template, but crest does not create the template.
| Argument | Description |
|---|---|
method |
HTTP method, e.g. GET |
path |
Route path, e.g. /company/{id} |
| Option | Description |
|---|---|
--responder=<value> |
The packaged responder stub to render: json or view. Default: json |
--stub=<value> |
Render a named stub instead; not together with --responder |
--template=<value> |
Template the view responder renders; defaults to <path>/index |
--force |
Overwrite an existing action |
crest make:action GET /company/all
crest make:action GET /company/{id} --responder=view # a view responderAliases: none. Flavors: ADR. See Generating Actions.
make:command
Create a crest command
crest make:command <name> [options]Creates a command class for crest, and prints the extra block of composer.json that registers it. A command from a package works in both flavors.
| Argument | Description |
|---|---|
name |
Command name, e.g. Greet |
| Option | Description |
|---|---|
--force |
Overwrite an existing command |
crest make:command GreetAliases: none. Flavors: ADR, MVC. See Adding Commands from a Package.
make:controller
Create an MVC controller
crest make:controller <name> [options]Creates an MVC controller with an empty indexAction(), and the base class CrestControllerBase that it extends. The name must give a class that the dispatcher can find from a URL: Users gives UsersController. Then crest prints the default namespace of the dispatcher, and the URL and the view of indexAction().
| Argument | Description |
|---|---|
name |
Controller name, e.g. Users |
| Option | Description |
|---|---|
--force |
Overwrite an existing controller |
--module=<value> |
Write the controller into a module, e.g. admin |
crest make:controller Users
crest make:controller Users --module=admin # in the admin moduleAliases: none. Flavors: MVC. See Generating Controllers.
make:database
Add a database to the project
crest make:database <driver> [options]Adds a database to a project that exists. It writes the new files, for example DbProvider, and prints the lines to add to the files that exist. For a project with no crest.php, use init --database.
| Argument | Description |
|---|---|
driver |
The database: mariadb, mysql, pgsql or sqlite |
| Option | Description |
|---|---|
--force |
Overwrite an existing DbProvider |
crest make:database mysql
crest make:database sqlite --force # overwrite DbProviderAliases: none. Flavors: ADR, MVC. See Adding a Database.
make:middleware
Create an ADR middleware
crest make:middleware <name> [options]Creates an ADR middleware class. Then crest prints the line that adds it to the middleware map of the router. The key of the map is a namespace suffix: an empty key guards each action.
| Argument | Description |
|---|---|
name |
Middleware name, e.g. Auth |
| Option | Description |
|---|---|
--force |
Overwrite an existing middleware |
crest make:middleware AuthAliases: none. Flavors: ADR.
make:model
Create an MVC model from a database table, or from each table with --all (relations come only from foreign keys)
crest make:model [table] [options]Reads a table from the database of the project, and writes an MVC model and the base class that it extends. Relations come only from FOREIGN KEY constraints.
This command boots the project: it reads the db service through the front controller that the bootstrap key of crest.php names.
| Argument | Description |
|---|---|
table |
Table name, e.g. users. Omit it with --all |
| Option | Description |
|---|---|
--all |
Create a model for each table of the database |
--exclude=<value> |
With --all: the tables to skip, separated by commas |
--force |
Overwrite an existing model |
--module=<value> |
Write the models into a module, e.g. admin |
--property=<value> |
For one table: property names, as column=name, separated by commas |
--views |
With --all: also create a model for each view |
crest make:model users
crest make:model --all --exclude=migrations # all the tables but migrations
crest make:model users --property=first_name=firstNameAliases: none. Flavors: MVC. See Generating Models.
make:module
Create an MVC module
crest make:module <name> [options]Creates an MVC module: Module.php, and the folders for its controllers, models and views. Then crest prints the lines to add to the front controller and the router. The key of the module is its folder in lowercase; use it in --module.
| Argument | Description |
|---|---|
name |
Module name, e.g. admin |
| Option | Description |
|---|---|
--force |
Overwrite an existing module |
crest make:module adminAliases: none. Flavors: MVC. See Generating Modules.
make:provider
Create a service provider
crest make:provider <name> [options]Creates a service provider class. Then crest prints the line that registers it in the front controller.
| Argument | Description |
|---|---|
name |
Provider name, e.g. Cache |
| Option | Description |
|---|---|
--force |
Overwrite an existing provider |
crest make:provider CacheAliases: none. Flavors: ADR, MVC.
make:repository
Create an ADR repository for a database table
crest make:repository <table> [options]Reads a table through the db service of the project, and writes an ADR repository and the base class that it extends. The base has find(), add(), update() and delete() for the primary key. The table must have a primary key with one column.
| Argument | Description |
|---|---|
table |
Table name, e.g. users |
| Option | Description |
|---|---|
--force |
Overwrite an existing repository |
crest make:repository usersAliases: none. Flavors: ADR. See Generating Repositories.
make:responder
Create an ADR responder
crest make:responder <name> [options]Creates an ADR responder class. The responder gives the result of the payload as a JSON response. Change it for another response.
| Argument | Description |
|---|---|
name |
Responder name, e.g. Album |
| Option | Description |
|---|---|
--force |
Overwrite an existing responder |
crest make:responder AlbumAliases: none. Flavors: ADR.
make:scaffold
Create MVC CRUD pages for a database table
crest make:scaffold <table> [options]Writes CRUD pages for one table of the database: a model, a form, a controller and three views. The pages have no login and no CSRF check.
Run it again when the table changes: crest writes the bases of the model and the form again.
| Argument | Description |
|---|---|
table |
Table name, e.g. users |
| Option | Description |
|---|---|
--force |
Overwrite the controller, the form and the views |
--module=<value> |
Write the pages into a module, e.g. admin |
crest make:scaffold users
crest make:scaffold users --module=adminAliases: none. Flavors: MVC. See Generating Scaffolds.
new
Create an ADR or MVC project
crest new <name> [options]Creates an MVC or an ADR project in the folder <name> of the working directory, or in --directory. In a terminal, it asks for each value that no option gives; --no-interaction takes the defaults.
By default, new runs nothing: no composer, no docker, no network. It writes the files and prints the next steps.
| Argument | Description |
|---|---|
name |
Project directory, e.g. my-app |
| Option | Description |
|---|---|
--flavor=<value> |
Flavor: mvc or adr. Default: mvc |
--template-engine=<value> |
The view engine of an MVC project: phtml, volt, or none for no views. An ADR project has no views, so new stops when you give it. Default: phtml |
--namespace=<value> |
Root namespace for the generated code. Default: App |
--php=<value> |
PHP version for composer.json and the Dockerfile, major.minor, 8.2 or later. Default: 8.4 |
--phalcon=<value> |
Phalcon: v5 (ext-phalcon ^5.24.1) or v6 (phalcon/phalcon ^6.0). Default: v5 |
--runtime=<value> |
Where the project commands run (the runtime key of crest.php): host or docker. Default: docker |
--service=<value> |
The docker compose service, for docker. Default: app |
--database=<value> |
The database: none, mariadb, mysql, pgsql or sqlite. Default: none |
--camel-case |
MVC: property names in camelCase (models.camelCase of crest.php) |
--get-set |
MVC: protected properties with a getter and a setter (models.getSet of crest.php) |
--force |
Write into a directory that is not empty, and overwrite files with the same names |
crest new my-app # an MVC project
crest new my-app --flavor=adr
crest new my-app --phalcon=v6 --runtime=host # Phalcon v6, with the PHP of the hostAliases: none. See Creating a Project.
route:list
List the routes the application answers
crest route:list [options]Lists each route that the application answers. An ADR application has no routes file: the command reads the action classes and asks the router of the framework what each one answers.
crest route:listAliases: none. Flavors: ADR.
serve
Start PHP’s built-in web server for the project
crest serve [options]Starts the built-in web server of PHP for the project, with the router script .htrouter.php and the document root public. The port is --port, else APP_PORT from the environment, else APP_PORT in .env, else 8080.
Press Ctrl+C to stop the server.
| Option | Description |
|---|---|
--port=<value> |
Port, 1 to 65535. Default: APP_PORT, then 8080 |
crest serve
crest serve --port=9000Aliases: server. See Running a Project.
stub:publish
Copy packaged stubs into the project for editing
crest stub:publish [name] [options]Copies the packaged stubs into resources/stubs of the project, where crest looks for them first. Edit the copies to change what the generators write. A project stub, which new uses, is copied only when you give its name.
| Argument | Description |
|---|---|
name |
A single stub, e.g. action. Omit to publish them all |
| Option | Description |
|---|---|
--flavor=<value> |
The flavor of a project stub, before the project exists. Default: mvc |
--force |
Overwrite stubs the project has already published |
crest stub:publish # all the stubs
crest stub:publish actionAliases: none. Flavors: ADR, MVC. See Custom Stubs.
up
Start the project containers
crest up [options]Starts the containers of the project with docker compose. Run it with a crest outside the vendor folder of the project, for example the global crest or the launcher ./crest. Then run install.
| Option | Description |
|---|---|
--build |
Rebuild the images first |
crest up
crest up --build # rebuild the images firstAliases: none. See Running a Project.
Global options
| Option | Description |
|---|---|
--config=<value> |
Path to the project configuration file |
--directory=<value> |
Directory to use instead of the working directory |
--trace |
Show the full exception trace |
--help, -h |
Show this help |
--quiet, -q |
Suppress non-essential output |
--no-interaction, -n |
Ask no questions; use the default answers |
--version, -V |
Show the version |