CLI and assets

Concept Core provides console commands to list registered modules and publish static files to public/. Component commands are attached automatically during ComponentsServiceProvider::boot().

component:list

php bin/console.php component:list

Prints a table: Name, Version, Class, Description — data from each active module’s ComponentInterface methods (name(), version(), description()).

If a component does not appear — check config/components.php and that ComponentsServiceProvider is registered last among HTTP providers.

component:publish-assets

Copies files and directories from the map returned by ComponentInterface::assets():

// AuthAdminComponent::assets()
public function assets(): array
{
    return [
        $this->pathManager->toRelative($this->componentDir . '/Assets/admin-tokens.js') =>
            $this->pathManager->getRelative(PathName::PUBLIC, 'components/auth-admin/js/admin-tokens.js'),
    ];
}
php bin/console.php component:publish-assets
  • Paths are relative to project root (PathManager::root())
  • File — copy; directory — mirror with overwrite
  • All active components are processed in one run

After changing JS/CSS in Component/Assets/, run the command again before deploy.

Module custom commands

Declare classes in ComponentInterface::commands():

// AuthAdminComponent::commands()
public function commands(): array
{
    return [
        UserListCommand::class,
    ];
}

The command is a regular Symfony Console class registered in the container (autowiring). Example:

// Commands/UserListCommand.php
final class UserListCommand extends Command
{
    protected function configure(): void
    {
        $this->setName('auth:user-list');
    }
    // execute() ...
}

See Creating commands.

Migrations and seeders

Paths from migrationPaths() and classes from seeders() are added to core registries:

php bin/console.php migration:list
php bin/console.php db:migrate
php bin/console.php db:seed
php bin/console.php db:seed -c "Concept\Components\AuthAdmin\Database\Seeders\UserSeeder"

db:seed without options — all registered seeders. For a single seeder specify the full FQCN in -c / --class (in quotes). Short class names do not work.

Global migrations from config/migrations.php and component migrations — in one list.

Different component sets per environment

// config/dev/components.php — only for APP_ENV=dev
return [
    'components' => [
        DebugBarComponent::class => DebugBarComponent::class,
    ],
];

ConfigServiceProvider merges override from config/{APP_ENV}/ — in dev DebugBar is added without changing the production list.

Component telemetry

During ComponentsServiceProvider::boot() for each active module TelemetryEvent::FRAMEWORK_COMPONENT_REGISTERED is recorded (context — component class). Data is available through TelemetryCollector — see Telemetry.