PHPackages                             baethon/symfony-console-input - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. baethon/symfony-console-input

ActiveLibrary

baethon/symfony-console-input
=============================

Generates command signature based on an input DTO

v1.0.0(1y ago)27[2 issues](https://github.com/baethon/symfony-console-input/issues)MITPHPPHP &gt;=8.4

Since Nov 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/baethon/symfony-console-input)[ Packagist](https://packagist.org/packages/baethon/symfony-console-input)[ RSS](/packages/baethon-symfony-console-input/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Symfony Console Input Plugin
============================

[](#symfony-console-input-plugin)

This project provides a streamlined way to define Symfony Console commands using PHP attributes and Data Transfer Objects (DTOs). It simplifies the configuration of arguments and options by leveraging metadata annotations, making it easier to maintain and extend console commands.

Features
--------

[](#features)

- Automatically generates command arguments and options from DTO properties.
- Supports metadata annotations (`#[Argument]`, `#[Option]`, etc.) to define command inputs.
- Easily integrates with Symfony's Console component.
- Provides a `UsesInputData` trait to configure and initialize input data automatically.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4

Installation
------------

[](#installation)

To install the plugin, use Composer:

```
composer require baethon/symfony-console-input
```

Getting Started
---------------

[](#getting-started)

### 1. Define Your Input DTO

[](#1-define-your-input-dto)

Create a class with properties annotated using provided attributes like `#[Argument]` or `#[Option]`.

```
use Baethon\Symfony\Console\Input\Attributes\Argument;
use Baethon\Symfony\Console\Input\Attributes\Option;

readonly class MyCommandInput
{
    public function __construct(
        #[Argument]
        public string $name,   // A required argument

        #[Option]
        public int $age = 18,  // An optional option with a default value
    ) {}
}
```

Important

The input class must define all arguments and options in the constructor.

### 2. Create a Command

[](#2-create-a-command)

Use the `UsesInputData` trait in your Symfony Console command class to leverage the input configuration:

```
use Baethon\Symfony\Console\Input\Attributes\InputData;
use Baethon\Symfony\Console\Input\UsesInputData;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'my-command')]
class MyCommand extends Command
{
    use UsesInputData;

    #[InputData]
    private MyCommandInput $input;

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln("Name: {$this->input->name}");
        $output->writeln("Age: {$this->input->age}");

        return Command::SUCCESS;
    }
}
```

Attributes
----------

[](#attributes)

### `#[Argument]`

[](#argument)

Marks a property as a required/optional argument.

### `#[Option]`

[](#option)

Marks a property as an option.

### `#[Shortcut]`

[](#shortcut)

Defines a shortcut for an option.

### `#[Description]`

[](#description)

Adds a description for the argument or option.

### `#[Name]`

[](#name)

Sets a different name for the argument or option.

Testing
-------

[](#testing)

Run tests using Pest:

```
./vendor/bin/pest
```

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

541d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/488bdbbb3187d1f4f6d9c92f0c716ad413f5e7fe53d3ec5ffefb37cfcad4ecf6?d=identicon)[radmen](/maintainers/radmen)

---

Top Contributors

[![radmen](https://avatars.githubusercontent.com/u/1190255?v=4)](https://github.com/radmen "radmen (20 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/baethon-symfony-console-input/health.svg)

```
[![Health](https://phpackages.com/badges/baethon-symfony-console-input/health.svg)](https://phpackages.com/packages/baethon-symfony-console-input)
```

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
