---
title: "Command Reference"
description: "Each command of Crest, with its arguments, its options and examples."
version: "1.0"
---

> Documentation Index
> Fetch the complete documentation index at: https://crest.phalcon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Reference

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](/1.0/introduction)). `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

```text
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.

```bash
crest about
```

Aliases: `info`, `i`. See [The global Crest and the project Crest](/1.0/how-crest-works#the-global-crest-and-the-project-crest).

## `config:show`

Show the resolved project configuration

```text
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.

```bash
crest config:show
```

Aliases: none. Flavors: ADR, MVC. See [Configuration](/1.0/configuration).

## `container:list`

List the services registered in the container

```text
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.

```bash
crest container:list
```

Aliases: none. Flavors: ADR. See [Commands that Boot the Project](/1.0/booting).

## `down`

Stop and remove the project containers

```text
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 |

```bash
crest down
crest down --volumes  # also remove the named volumes
```

Aliases: none. See [Running a Project](/1.0/running).

## `event:list`

List the listeners attached to the events manager

```text
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.

```bash
crest event:list
```

Aliases: none. Flavors: ADR. See [Commands that Boot the Project](/1.0/booting).

## `init`

Write crest.php for an existing project

```text
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` |

```bash
crest init
crest init --database=mysql      # also add a MySQL database
crest init --flavor=adr --force  # overwrite crest.php
```

Aliases: none. See [Adding Crest to an Existing Project](/1.0/existing-project).

## `install`

Install composer dependencies in the project container

```text
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.

```bash
crest install
```

Aliases: none. See [Running a Project](/1.0/running).

## `list`

List the available commands

```text
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.

```bash
crest list
```

Aliases: `commands`, `enumerate`.

## `make:action`

Create an ADR action for a route

```text
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. Default: \<path\>/index |
| `--force` | Overwrite an existing action |

```bash
crest make:action GET /company/all
crest make:action GET /company/{id} --responder=view  # a view responder
```

Aliases: none. Flavors: ADR. See [Generating Actions](/1.0/actions).

## `make:command`

Create a crest command

```text
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 |

```bash
crest make:command Greet
```

Aliases: none. Flavors: ADR, MVC. See [Adding Commands from a Package](/1.0/package-commands).

## `make:controller`

Create an MVC controller

```text
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, the URL of indexAction(), and its view when the project has views.

| 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 |

```bash
crest make:controller Users
crest make:controller Users --module=admin  # in the admin module
```

Aliases: none. Flavors: MVC. See [Generating Controllers](/1.0/controllers).

## `make:database`

Add a database to the project

```text
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 |

```bash
crest make:database mysql
crest make:database sqlite --force  # overwrite DbProvider
```

Aliases: none. Flavors: ADR, MVC. See [Adding a Database](/1.0/database).

## `make:middleware`

Create an ADR middleware

```text
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 |

```bash
crest make:middleware Auth
```

Aliases: 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)

```text
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 |

```bash
crest make:model users
crest make:model --all --exclude=migrations             # all the tables but migrations
crest make:model users --property=first_name=firstName
```

Aliases: none. Flavors: MVC. See [Generating Models](/1.0/models).

## `make:module`

Create an MVC module

```text
crest make:module <name> [options]
```

Creates an MVC module: Module.php, and the folders for its controllers and models, and for its views when the project has 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 |

```bash
crest make:module admin
```

Aliases: none. Flavors: MVC. See [Generating Modules](/1.0/modules).

## `make:provider`

Create a service provider

```text
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 |

```bash
crest make:provider Cache
```

Aliases: none. Flavors: ADR, MVC.

## `make:repository`

Create an ADR repository for a database table

```text
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 |

```bash
crest make:repository users
```

Aliases: none. Flavors: ADR. See [Generating Repositories](/1.0/repositories).

## `make:responder`

Create an ADR responder

```text
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 |

```bash
crest make:responder Album
```

Aliases: none. Flavors: ADR.

## `make:scaffold`

Create MVC CRUD pages for a database table

```text
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 |

```bash
crest make:scaffold users
crest make:scaffold users --module=admin
```

Aliases: none. Flavors: MVC. See [Generating Scaffolds](/1.0/scaffolds).

## `new`

Create an ADR or MVC project

```text
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 |

```bash
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 host
```

Aliases: none. See [Creating a Project](/1.0/creating-a-project).

## `route:list`

List the routes the application answers

```text
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.

```bash
crest route:list
```

Aliases: none. Flavors: ADR.

## `serve`

Start PHP's built-in web server for the project

```text
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 |

```bash
crest serve
crest serve --port=9000
```

Aliases: `server`. See [Running a Project](/1.0/running).

## `stub:publish`

Copy packaged stubs into the project for editing

```text
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 |

```bash
crest stub:publish         # all the stubs
crest stub:publish action
```

Aliases: none. Flavors: ADR, MVC. See [Custom Stubs](/1.0/stubs).

## `up`

Start the project containers

```text
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 |

```bash
crest up
crest up --build  # rebuild the images first
```

Aliases: none. See [Running a Project](/1.0/running).

## 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 |

Source: https://crest.phalcon.io/1.0/commands/index.mdx
