phpsymfonycomposer-php

Creating Symfony 5 skeleton entity - maker bundle not working


I'm trying to run

make:entity

But I receive an error:

There are no commands defined in the "make" namespace

You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev"

I follow that advise and install the bundle by doing:

composer require symfony/maker-bundle --dev

It installs successfully: enter image description here

And yet when I try to run make:entity I get exactly the same error:

enter image description here

There are no commands defined in the "make" namespace

You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev"

What am I missing?


Solution

  • When you require a package using the --dev flag, the package will be installed as a development package.

    These are packages that should not be enabled on production, when your application is actually deployed. They have to be installed on your development machine, and on your development machine only.

    If you check your bundles.php file you'll see this line:

    Symfony\Bundle\MakerBundle\MakerBundle::class    => ['dev' => true],
    

    This ensures that the bundle is only enabled when your APP_ENV variable is set to dev.

    Since you are running your application on production mode, the bundle is not enabled.

    Just change your APP_ENV to dev so that the package is enabled, and you'll be able to run make commands.