I’ve read the instructions but clearly I’m missing something. I installed laminas-cli via composer as instructed. Then I created this config and put it in config/autoload/laminas-cli.global.php
:
<?php
return [
'laminas-cli' => [
'commands' => [
'admin:test' => \InterpretersOffice\Admin\Service\TestCommand::class,
],
],
];
and confirmed that this config was being read.
Then I created a module/Admin/src/Service/TestCommand.php
:
<?php
namespace InterpretersOffice\Admin\Service;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class TestCommand extends Command {
public function configure()
{
}
public function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input,$output);
$io->success("Test has succeeded.");
return 0;
}
}
and I confirmed that the composer’s autoloader was able to load it. Then I said:
vendor/bin/laminas admin:test
and got
The command "admin:test" does not exist.
and I can’t say I’m surprised. It feels like I’m missing a step or two but haven’t been able to figure it out.
btw I’ve read this thread about setting up cli more than once and have considered trying some of that advice, but I thought maybe the laminas-cli does some of that for us.
Thanks.