---
title: "Moving from Devtools"
description: "Move a project from Phalcon Devtools to Crest: the Crest command for each devtools command, and the steps for the models."
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.

# Moving from Devtools

phalcon-devtools is the Phalcon Devtools command line tool (see [References](/1.0/introduction#references)). Crest replaces it. The table gives the Crest command for each command of devtools v4. The aliases are in parentheses. The options are not the same: the section of each command gives its options.

| devtools v4 | Crest |
|---|---|
| `info` (`i`) | `about` (`info`, `i`); see [Command reference](/1.0/commands) |
| `commands` (`list`, `enumerate`) | `list` (`commands`, `enumerate`); see [Command reference](/1.0/commands) |
| `serve` (`server`) | `serve` (`server`); see [Running a project](/1.0/running) |
| `project` (`create-project`) | `new`; see [Creating a project](/1.0/creating-a-project) |
| `controller` (`create-controller`) | `make:controller`; see [Generating controllers](/1.0/controllers) |
| `model` (`create-model`) | `make:model`; see [Generating models](/1.0/models) |
| `all-models` (`create-all-models`) | `make:model --all`; see [All the tables](/1.0/models#all-the-tables) |
| `module` (`create-module`) | `make:module`; see [Generating modules](/1.0/modules) |
| `scaffold` (`create-scaffold`) | `make:scaffold`; see [Generating scaffolds](/1.0/scaffolds) |
| `migration` (`create-migration`) | `vendor/bin/phalcon-migrations`, the command of the package `phalcon/migrations`; see [References](/1.0/introduction#references) |
| `console` (`shell`, `psysh`) | not in Crest 1.0. Install PsySH with `composer require --dev psy/psysh`. `vendor/bin/psysh <file>` loads `<file>` first, as `console --include=<file>` did |
| `webtools` (`create-webtools`) | none: Crest has no web interface |

**A project of devtools.** Crest writes each class with a namespace, and `init` needs a psr-4 entry in `composer.json` (see [Adding Crest to an existing project](/1.0/existing-project)). devtools wrote no `composer.json`: `app/config/loader.php` loads the classes with `Phalcon\Loader`. In a `simple` project of devtools, the classes have no namespace. Before you run `init`:

1. Add the psr-4 entry to `composer.json`, for example `"App\\": "app/"`.
2. Give each class the namespace of its folder. With `"App\\": "app/"`, a class in `app/controllers` has the namespace `App\controllers`. For `App\Controllers`, change the name of the folder to `app/Controllers`. A `modules` project of devtools has namespaces already: give each one a psr-4 entry.
3. Phalcon finds a controller by its namespace. Set the namespace of the controllers with `setDefaultNamespace()` of the `dispatcher` service.
4. Add a front controller for Crest. `make:model` and `make:scaffold` read the `db` service, so Crest starts the class of the `bootstrap` key (see [Commands that boot the project](/1.0/booting)). A project of devtools has no such class: `public/index.php` defines `BASE_PATH` and `APP_PATH`, and includes `app/config/services.php`, which registers the `db` service. This is the same in the `simple`, `micro` and `modules` projects. Add `app/AppFront.php`, which does the same and returns the container. `public/index.php` does not change:

   ```php
   <?php

   declare(strict_types=1);

   namespace App;

   use Phalcon\Di\DiInterface;
   use Phalcon\Di\FactoryDefault;

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

       public function boot(): DiInterface
       {
           defined('BASE_PATH') || define('BASE_PATH', $this->root);
           defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');

           $di = new FactoryDefault();

           include APP_PATH . '/config/services.php';

           return $di;
       }
   }
   ```

5. Run `composer dump-autoload`.
6. Run `crest init`. For the front controller, `init` proposes `App\AppFront`. For the questions of the paths, give the folders of the project, for example `app/controllers`, `app/models` and `app/views`.

**The models.** A model of devtools has its properties. A model of Crest extends a base that has the properties, and Crest writes the base again each time you run `make:model` (see [Generating models](/1.0/models)). Move each model with the steps of "Moving a devtools `--get-set` model" (see [Getters and setters](/1.0/models#getters-and-setters)). For a model that devtools wrote without `--get-set`, keep `'getSet' => false` in step 1: `init` writes it.

**The Annotations strategy.** With `--annotate`, devtools wrote the annotations `@Column`, `@Primary` and `@Identity` on the properties. A base of Crest has typed properties and no annotations. When the `modelsMetadata` service uses `Phalcon\Mvc\Model\MetaData\Strategy\Annotations`, Phalcon reads the columns from these annotations, and finds none. The C extension stops with this error:

```text
No properties with annotations were found in class Users
```

Do one of these:

- Change to the Introspection strategy, the default of Phalcon: remove the `setStrategy()` call of the `modelsMetadata` service. Phalcon then reads the columns from the database.
- Keep the Annotations strategy. In each model, declare each property of the base again, with the same visibility, type and default, and put the annotations on it. Crest writes a model one time (only `--force` replaces it), so the annotations stay. When a column changes, change its annotation:

  ```php
  class Users extends UsersBase
  {
      /**
       * @Primary
       * @Identity
       * @Column(column="id", type="integer", nullable=false)
       */
      public ?int $id = null;
  }
  ```

  On `phalcon/phalcon`, the Annotations strategy also needs the package `phalcon/annotations`.

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