Search by

phalcon / crest

phalcon

Command line application for Phalcon

Package info

github.com/phalcon/crest

pkg:composer/phalcon/crest

Fund package maintenance!

phalcon

Open Collective

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 16

dev-master 2026-09-28 12:15 UTC

This package is auto-updated.

Last update: 2026-09-28 12:16:39 UTC


README

Latest Version PHP Version Total Downloads License

Crest CI Quality Gate Status Coverage PDS Skeleton

Discord Contributors OpenCollective Backers OpenCollective Sponsors

Command line application for Phalcon - generators, introspection and project tooling.

Requirements

  • PHP ^8.1
  • Phalcon, either the ext-phalcon C extension (^5.18) or the phalcon/phalcon PHP implementation (^6) - crest itself needs neither to run

Install

In a project:

composer require --dev phalcon/crest

To create projects, also install crest globally. The global composer vendor/bin directory must be in your PATH:

composer global require phalcon/crest

Usage

Run crest in a project. The commands that work on the project need the project autoloader and its Phalcon, so a global crest passes them to the project's vendor/bin/crest and returns its exit status:

crest                                 list available commands
crest about                           environment and version report
crest make:action GET /company/all

new, up, down, install and --version always run in the crest that you type. Without a global crest, run vendor/bin/crest in the project. crest finds the project from a subdirectory, or from --directory. If the project requires phalcon/crest but has no vendor/bin/crest yet, crest stops and tells you to run crest install or composer install.

To create a project, use the global crest. The new project requires phalcon/crest, so after composer install it has its own vendor/bin/crest:

crest new my-app                      create an ADR project

Global options

Option Purpose
--config=<file> explicit path to crest.php
--directory=<dir> project root override; for new, the directory the project is created in
--trace full exception trace
--help, -h usage for the current command
--quiet, -q suppress non-essential output
--version crest version

Configuration

crest.php at the project root is optional. Without it, crest reads composer.json's psr-4 map and defaults paths.action to src/Action.

return [
    'flavor'    => 'adr',
    'namespace' => 'App',
    'paths'     => ['action' => 'src/Action'],
];

Namespaces are resolved from your psr-4 map, so a path must be covered by an autoload rule - src/Action under App\ => src/ becomes App\Action. If you write to a directory your autoloader does not cover, declare the namespace outright:

return [
    'paths'      => ['action' => 'app/Handlers'],
    'namespaces' => ['action' => 'Shop\Handlers'],
];

Booting the project

container:list and event:list report services and listeners, which exist only once the application has registered them, so those two start your front controller. Name it in crest.php:

return [
    'bootstrap' => App\Front\ApiFront::class,
];

The class is constructed with the project root and has to declare boot(). There is no base class and no interface - boot() is the whole contract, and what it returns has to implement Phalcon\Contracts\Container\Service\Collection, which Phalcon\Container\Container does. See docs/index.md for the rest.

Every other command - the generators, about, config:show and route:list - reads the filesystem and keeps working on a project that does not currently run.

Custom stubs

Copy a stub into resources/stubs/<flavor>/ in your project and crest uses yours instead of the packaged one.

The project-* stubs that new renders are published by name only. See docs/index.md.

Development

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 analyze

Set PHALCON_VARIANT=v6 in .env and rebuild to test against phalcon/phalcon instead of the C extension.

License

BSD-3-Clause. See LICENSE.