PHPackages                             switon/command - 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. [CLI &amp; Console](/categories/cli)
4. /
5. switon/command

ActiveLibrary[CLI &amp; Console](/categories/cli)

switon/command
==============

Shared command discovery and reflection metadata for CLI listings and AI tooling for Switon Framework

v1.0.0(1mo ago)04311MITPHPPHP &gt;=8.3CI passing

Since Jun 6Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/command)[ Packagist](https://packagist.org/packages/switon/command)[ Docs](https://github.com/switon-php/command)[ RSS](/packages/switon-command/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (2)Used By (11)

Switon Command Package
======================

[](#switon-command-package)

[![CI](https://camo.githubusercontent.com/6a05e5c11092e3987311612b16a95a2835967457847cf4e84dd35f3daecadc0c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f636f6d6d616e642f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/switon-php/command/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's command metadata layer for auto-discovery, PHPDoc help, AI synopses, and short-option aliases.

Highlights
----------

[](#highlights)

- **Automatic discovery:** package commands come from `extra.switon.commands`, and app commands are scanned automatically.
- **Docblock help:** command help comes from class and action docblocks.
- **AI synopsis:** `#[Tool]` adds an AI-facing synopsis for an action.
- **Visibility controls:** `#[Hidden]` can hide a command or action from default listings.
- **Explicit option aliases:** `#[ShortOption]` pins short aliases where needed.

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

[](#installation)

```
composer require switon/command
```

Quick Start
-----------

[](#quick-start)

```
use Switon\Command\Attribute\ShortOption;
use Switon\Command\Attribute\Tool;

/**
 * Report commands.
 */
final class ReportCommand
{
    /**
     * Return a report summary.
     *
     * @param string $id Report id to inspect
     * @param bool $shout Uppercase the output
     */
    #[Tool('Returns JSON report summary by id.')]
    public function statusAction(#[ShortOption('x')] string $excluded, bool $shout = false): array {
        return ['excluded' => $excluded, 'shout' => $shout];
    }
}
```

`CommandInspector` feeds `cli` help/list output and `beacon` JSON tool metadata.

Rendered from the example above:

```
report Report commands.
  report:status    Return a report summary.
    Option           Description              Default
    --excluded, -x   Excluded id to inspect
    --shout, -s      Uppercase the output     false

```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance90

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity48

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

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc0f20ad15b0ae9fbf9c6e2cd3008692b0c88a877ec8d3e0119211314bf86fc8?d=identicon)[switon](/maintainers/switon)

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (1 commits)")

---

Tags

commanddiscoverymetadataswitontoolingmetadatadiscoverycommandtoolingswiton

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/switon-command/health.svg)

```
[![Health](https://phpackages.com/badges/switon-command/health.svg)](https://phpackages.com/packages/switon-command)
```

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.7M304](/packages/league-climate)[league/tactician

A small, flexible command bus. Handy for building service layers.

86516.0M138](/packages/league-tactician)[nategood/commando

PHP CLI Commando Style

8033.4M40](/packages/nategood-commando)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2959.5M263](/packages/helhum-typo3-console)[adhocore/cli

Command line interface library for PHP

3511.4M59](/packages/adhocore-cli)[mrrio/shellwrap

Use any command-line tool as a PHP function.

738214.3k2](/packages/mrrio-shellwrap)

PHPackages © 2026

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