Files
InvoiceShelf/app/Console/Commands/InstallModuleCommand.php
Darko Gjorgjijoski 8cc4a6fa98 refactor(services): move ModuleInstaller to app/Support/Module
ModuleInstaller has the same shape as Updater (moved in 7cf72b9f): every method is public static, no constructor, no DI, no instance state. It orchestrates marketplace operations — fetch catalog, download zip, verify checksum, unzip, copy files, run module:migrate/module:enable, dispatch install/enable events — but the orchestration itself is stateless procedural plumbing.

Emitting events and writing to the Module eloquent model doesn't make it a service; plenty of static helpers touch models. The distinguishing factor is stateless-procedural vs DI-injected-workflow, and this is clearly the former.

4 consumers updated: ModulesController, ModuleInstallationController, InstallModuleCommand, and a doc comment in config/invoiceshelf.php. 350 tests still pass.

This leaves app/Services/ with no single-file driver-less subdirs except Mail/Module/Pdf/Storage which have multiple files each. The Module/ subdir in Services is now deleted entirely — the marketplace installer moved out and there were no other files in there.
2026-04-11 13:30:00 +02:00

44 lines
840 B
PHP

<?php
namespace App\Console\Commands;
use App\Support\Module\ModuleInstaller;
use Illuminate\Console\Command;
class InstallModuleCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'install:module {module} {version}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install cloned module.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle(): int
{
ModuleInstaller::complete($this->argument('module'), $this->argument('version'));
return Command::SUCCESS;
}
}