componenta/app-console

Console runtime integration for Componenta applications

Maintainers

Package info

github.com/componenta/app-console

pkg:composer/componenta/app-console

Statistics

Installs: 7

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-15 10:54 UTC

This package is auto-updated.

Last update: 2026-06-15 12:06:30 UTC


README

Console runtime integration for Componenta applications. The package connects componenta/app with Symfony Console, registers console boot targets, provides a command registry, and contributes framework maintenance commands.

Use this package when an application has CLI commands. It does not provide the base application kernel; that belongs to componenta/app.

Installation

composer require componenta/app-console

The package exposes Componenta\App\Console\ConfigProvider through Composer metadata, so componenta/composer-plugin can add it to the generated provider file.

Dependencies

The package requires PHP ^8.4, componenta/app, componenta/class-finder, componenta/config, componenta/di, componenta/error-handler, componenta/path-resolver, componenta/reflection, componenta/var-export, PSR-11, PSR-3, Symfony Console, Symfony EventDispatcher, and Symfony Lock.

Registered Services

ConfigProvider registers:

Service or config key Purpose
ConsoleAppAdapter Creates a console application for Scope::CLI.
ConsoleBootTargetAdapter Adapts the console application to a boot target.
ConsoleBootloader Boots console commands into the target registry.
ConsoleCommandRegistryInterface Alias to ConsoleCommandRegistry.
EventDispatcherFactoryInterface Factory for Symfony Console event dispatchers.
ConfigKey::COMMANDS List of command service ids registered by packages or the application.

Runtime Behavior

ConsoleBootloader runs in console scope. It reads all configured command service ids from Componenta\App\Console\ConfigKey::COMMANDS, resolves them from the container, and registers them in the Symfony Console application.

In development mode it also scans the class iterator for Symfony #[AsCommand] attributes. Attribute-discovered commands are skipped when the same class was already registered through config. In production mode command discovery is disabled; commands must be present in the built configuration.

Application-local commands can be registered from config/console.php when that file is loaded by the application config graph:

use App\Console\ImportPostsCommand;
use Componenta\App\Console\ConfigKey;

return [
    ConfigKey::COMMANDS => [
        ImportPostsCommand::class,
    ],
];

Packages should contribute commands from their own ConfigProvider by appending to the same key.

Maintenance Commands

The package registers these commands:

Command Purpose
app:build Writes build cache files for configuration and the DI container.
app:preload Generates preload.php from existing build cache artifacts.
app:cache:clear Clears build, development, and runtime cache directories. Use --build, --dev, or --runtime to limit the scope.

Public API

  • ConsoleCommandRegistryInterface stores command definitions for the console application.
  • ConsoleBootTargetInterface is the boot target for packages that want to add commands.
  • InputFactoryInterface, OutputFactoryInterface, and IOFactory adapt Symfony Console input and output.
  • ConfigKey::COMMANDS is the production-safe command registration point.

Related Packages