Answer the question
In order to leave comments, you need to log in
How to overcome error with namespace in symfony 4?
Good afternoon, I installed the longman/telegram-bot library, it works with basic commands, but when I create my own folder with my commands in the docks, it says that my commands should have a namespace
namespace Longman\TelegramBot\Commands\UserCommands;
Expected to find class "App\Social\TelegramCommands\TestCommand" in file "/var/www/test.com/src/Social/TelegramCommands/TestCommand.php" while importing services from resource "../src/*", but it wasn't found! Check the namespace prefix used with the resource in /var/www/test.com/config/services.yaml (which is loaded in resource "/var/www/test.com/config/services.yaml").
Answer the question
In order to leave comments, you need to log in
Put these commands in a separate folder (not src) and write the composer.json
appropriate namespace for them in the autoload
. But in fact, in the end, you will not be able to integrate this library with symfony (more precisely, it will work, but these will be crutches), because it is not possible to pass your dependencies to the constructor
"autoload": {
"psr-4": { "Longman\\TelegramBot\\Commands\\": "commands/" }
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question