Crest is a command line application for Phalcon. It generates code, shows information about a project, and creates and runs projects. For the two flavors of project that Crest works with, MVC (Model-View-Controller) and ADR (Action-Domain-Responder), see Overview. The documentation is on the Phalcon site: https://docs.phalcon.io/6.0/crest/.
- PHP
^8.2, with thetokenizerextension (ext-tokenizer; PHP turns it on by default) - Phalcon v5, the
ext-phalconC extension (^5.24.1), or Phalcon v6, thephalcon/phalconPHP implementation (^6). Crest itself needs neither of them to run
Crest has no tagged release yet. Packagist has only the version dev-master, and the default minimum-stability of composer is stable. Thus give the version in the composer require command.
In a project, install Crest as a dev dependency. This copy is the project Crest, in vendor/bin/crest (see The global Crest and the project Crest):
composer require --dev phalcon/crest:dev-masterTo create projects, also install Crest globally. The global composer vendor/bin folder must be in your PATH:
composer global require phalcon/crest:dev-masterOn a host with docker and no PHP, one command creates a project, starts it and installs it (see The setup script):
curl -fsSL https://phalcon.io/crest-setup | sh -s -- my-appcrest new my-app
cd my-app
./crest up
./crest install./crest up starts the containers, and ./crest install installs the composer dependencies. Then GET / answers on http://localhost:8080/. For an ADR project, PHP on the host, and the other ways, see Quick start.
The documentation is on the Phalcon site: https://docs.phalcon.io/6.0/crest/. The same text is in docs/index.md. For the commands and their options, see Command reference, or run crest <command> --help.
docker compose up -d
docker exec crest-app composer install
docker exec crest-app composer test
docker exec crest-app composer cs
docker exec crest-app composer analyzeSet PHALCON_VARIANT=v6 in .env and rebuild to test against phalcon/phalcon instead of the C extension.
make:model reads the database of the project. Its tests are in tests/Database, and they run on SQLite, MySQL 8.4, MariaDB 11.4 and PostgreSQL 18. docker compose up -d starts the servers as the services mysql, mariadb and postgres. The DATA_* lines of resources/.env.example tell the tests where the servers are: copy them into .env, then run docker compose up -d --build --force-recreate, so that crest-app gets the new values.
docker exec crest-app composer test-db
docker exec crest-app composer test-db-sqlitetest-db runs the four suites. test-db-sqlite, test-db-mysql, test-db-mariadb and test-db-pgsql run one suite. composer test runs no database test. composer test-coverage and Infection run the unit tests and the SQLite tests in one run (resources/full/phpunit.xml).
Warning: a database suite removes each table of its database, before and after each test. The DATA_* values must name a database that only the tests use. Run one suite at a time on a database. A MySQL, MariaDB or PostgreSQL suite stops when its DATA_*_NAME value is not set.
A container built with PHALCON_VARIANT=v6 has no C extension, so the commands above run the v6 path. To run the v6 path in the v5 container, use php -n. php -n does not load the C extension, pdo_mysql or pdo_pgsql, so load the PDO driver with -d extension=:
docker exec crest-app php -n vendor/bin/phpunit -c resources/phpunit.sqlite.xml
docker exec crest-app php -n -d extension=pdo_mysql vendor/bin/phpunit -c resources/phpunit.mysql.xml
docker exec crest-app php -n -d extension=pdo_mysql vendor/bin/phpunit -c resources/phpunit.mariadb.xml
docker exec crest-app php -n -d extension=pdo_pgsql vendor/bin/phpunit -c resources/phpunit.pgsql.xmlBSD-3-Clause. See LICENSE.