Skip to content

Quick Start

Create a project with crest new, then start it with docker or with PHP on the host.

crest new creates a project (see Creating a project). Run it with the global Crest of Installation. On a host with docker and no PHP, use With Docker only instead.

crest new my-app                      # create an MVC project
crest new my-app --flavor=adr         # create an ADR project

In a terminal, new asks for each value that no option gives. An empty answer takes the default (see Creating a project).

For an MVC project with no database, the output of new gives two ways to run the project. With docker, you use ./crest, a script that crest new writes into the project (see The launcher). With PHP on the host, you use crest serve. The next two sections explain each way. The output is:

Created my-app/

Nothing runs it yet. With docker:

    cd my-app
    ./crest up
    ./crest install

Or with PHP and composer on the host:

    cd my-app
    composer install
    crest serve

Then GET / answers from src/Controllers/IndexController.php

With Docker

With docker on the host, run:

cd my-app
./crest up
./crest install

./crest up starts the containers. ./crest install installs the composer dependencies (see The launcher). A v5 project compiles the Phalcon extension in ./crest up. This takes some minutes. Then GET / answers on http://localhost:8080/.

With PHP on the host

Without docker, create the project with crest new my-app --runtime=host: the project Crest then runs with the PHP of the host (see The runtime). With PHP and composer on the host, run:

cd my-app
composer install
crest serve

crest serve starts PHP’s built-in web server for the project (see Running a project). By default, crest serve listens on 127.0.0.1:8080.

With Docker only

On a host with docker and no PHP, one command creates a project, starts it and installs it, as in With Docker. The command downloads the crest-setup script and runs it. my-app is the name of the project:

curl -fsSL https://phalcon.io/crest-setup | sh -s -- my-app

Then GET / answers on http://localhost:8080/. On Windows, run the command in the Windows Subsystem for Linux (WSL2).

For another port, set APP_PORT. The script writes it into the project .env, the file of settings that docker compose reads (see The launcher):

curl -fsSL https://phalcon.io/crest-setup | APP_PORT=9000 sh -s -- my-app

The setup script gives the details: the options, the errors, and how to read the script before it runs.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close