---
title: "Commands that Boot the Project"
description: "The commands that start the front controller of the project to read its services, its listeners and its database."
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.

# Commands that Boot the Project

Four commands read objects that exist only after the application registers them. [`container:list`](/1.0/commands) reads the services and lists them, and [`event:list`](/1.0/commands) reads the listeners of the events manager and lists them. `make:model` and `make:scaffold` (see [Generating scaffolds](/1.0/scaffolds)) read the `db` service (see [The database](/1.0/creating-a-project#the-database)). Thus these commands start your front controller: they boot the project. Name the front controller in the `bootstrap` key of `crest.php`:

**MVC**

```php
return [
    'bootstrap' => App\AppFront::class,
];
```

**ADR**

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

Crest constructs the class with the project root. The constructor can take the root if the class needs it. The class must declare `boot()`. There is no class to extend and no interface to implement: `boot()` is the whole contract. In the MVC example, `boot()` returns a `FactoryDefault` (a `Phalcon\Di\DiInterface`). In the ADR example, `boot()` returns a `Phalcon\Container\Container`. Each one is a DI container (see [The MVC project](/1.0/creating-a-project#the-mvc-project)):

**MVC**

```php
use Phalcon\Di\DiInterface;
use Phalcon\Di\FactoryDefault;

final class AppFront
{
    public function __construct(private readonly string $projectRoot)
    {
    }

    public function boot(): DiInterface
    {
        $container = new FactoryDefault();

        // register your providers, with the db service

        return $container;
    }
}
```

**ADR**

```php
use Phalcon\Container\Container;

final class ApiFront
{
    public function __construct(private readonly string $root)
    {
    }

    public function boot(): Container
    {
        $container = new Container();

        // register your services

        return $container;
    }
}
```

`boot()` must return an object. Each command has its own conditions for that object:

| Command | Flavor | Requires the returned object to |
|---|---|---|
| `container:list` | **ADR** | implement `Phalcon\Contracts\Container\Service\Collection` and `Phalcon\Contracts\Container\Service\Enumerable` |
| `event:list` | **ADR** | implement `Collection`, and hold a registered `Phalcon\Events\Manager` |
| `make:model`, `make:scaffold` | **MVC** | implement `Phalcon\Di\DiInterface`, and hold a `db` service that is a `Phalcon\Db\Adapter\AdapterInterface` |

`Phalcon\Container\Container` implements both contracts of the `container:list` row. Thus `boot()` can return a `Phalcon\Container\Container` for `container:list`.

For `event:list`, "registered" means a definition or an instance that exists. A manager that the container can only autowire does not count. In that case, Crest stops with an error that says that the bootstrap registers no manager. It does not show zero listeners from a new instance that it made itself.

All the other commands, for example the other generators, `about`, `config:show` and `route:list`, do not start your front controller. Thus they also work on a project that does not run. `make:database` starts it when it can, to look for a `db` service, and also works on a project that does not run (see [Adding a database](/1.0/database)).

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