Replies: 3 comments 6 replies
-
Although I'm not sure why, it seems that I have to explicitly set my commands to public, e.g. App\Command\UploadCommand:
public: true But even this isn't enough when I try to compile it as a phar. Hmm. |
Beta Was this translation helpful? Give feedback.
-
I think you should use |
Beta Was this translation helpful? Give feedback.
-
Creating a CLI application using the Symfony fullstack framework, if the same as creating a web app:
Then you can remove the HTTP entry point:
If your application is small, you can choose to not follow the full flex architecture and embrace something more custom as proposed by Fabien: https://speakerdeck.com/fabpot/symfony-in-2025-scaling-to-0?slide=26 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The docs for creating a simple Console application are at
https://symfony.com/doc/current/components/console/usage.html
But I can't find anything that describes how to create a Framework Console Application, which of course would have all the goodies of dependency injection and autowiring.
For example, I want to create two simple commands, upload and download, which interact with my server. They work fine in a bundle or in a regular symfony application (with bin/console), but I want
bin/myapp upload
and I can't figure out how to inject the http client and other dependencies.Any suggestions or examples? I've tried copying from bin/console, but I don't want all the registered commands, just mine.
How do I get the services from the container in a console command?
Beta Was this translation helpful? Give feedback.
All reactions