PHPackages                             stecman/symfony-console-completion - 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. stecman/symfony-console-completion

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

stecman/symfony-console-completion
==================================

Automatic BASH completion for Symfony Console Component based applications.

v0.15.0(5mo ago)42026.3M↓11.5%27[10 issues](https://github.com/stecman/symfony-console-completion/issues)[3 PRs](https://github.com/stecman/symfony-console-completion/pulls)20MITPHPPHP &gt;=8.1CI passing

Since May 26Pushed 3mo ago10 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (32)Used By (20)

BASH/ZSH auto-complete for Symfony Console applications
=======================================================

[](#bashzsh-auto-complete-for-symfony-console-applications)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7da584a7c87ab4ee1dba69aa90601d1527c44332a708156b8b26296ce781c527/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f737465636d616e2f73796d666f6e792d636f6e736f6c652d636f6d706c6574696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/stecman/symfony-console-completion/?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/e3fc4dcae3a5dc9db21bb76770537efd46b259035a240e9156dbf27093dc3d87/68747470733a2f2f706f7365722e707567782e6f72672f737465636d616e2f73796d666f6e792d636f6e736f6c652d636f6d706c6574696f6e2f76)](https://packagist.org/packages/stecman/symfony-console-completion)[![Total Downloads](https://camo.githubusercontent.com/a743196c79787dfb1d5eff1aaedf9d9056a1c6b4d7cd2d7bf3a62c2e5ac99830/68747470733a2f2f706f7365722e707567782e6f72672f737465636d616e2f73796d666f6e792d636f6e736f6c652d636f6d706c6574696f6e2f646f776e6c6f616473)](https://packagist.org/packages/stecman/symfony-console-completion)[![License](https://camo.githubusercontent.com/26e3a0173bb70118d2282ecb21a759de5044d8074d76994eab44900b4a7cf19a/68747470733a2f2f706f7365722e707567782e6f72672f737465636d616e2f73796d666f6e792d636f6e736f6c652d636f6d706c6574696f6e2f6c6963656e7365)](https://packagist.org/packages/stecman/symfony-console-completion)[![PHP Version Require](https://camo.githubusercontent.com/c3573ef8f58d71bdaa23cb3c5d6fed01ea59b6416d173641a85e2c2144510a00/68747470733a2f2f706f7365722e707567782e6f72672f737465636d616e2f73796d666f6e792d636f6e736f6c652d636f6d706c6574696f6e2f726571756972652f706870)](https://packagist.org/packages/stecman/symfony-console-completion)

This package provides automatic (tab) completion in BASH and ZSH for Symfony Console Component based applications. With zero configuration, this package allows completion of available command names and the options they provide. User code can define custom completion behaviour for argument and option values.

Example of zero-config use with Composer:

[![Composer BASH completion](https://camo.githubusercontent.com/5f7797651c9434914271f54a4d9a12a5078313feae262ddad814bc5101c874ce/68747470733a2f2f692e696d6775722e636f6d2f4d6f44576b62792e676966)](https://camo.githubusercontent.com/5f7797651c9434914271f54a4d9a12a5078313feae262ddad814bc5101c874ce/68747470733a2f2f692e696d6775722e636f6d2f4d6f44576b62792e676966)

Zero-config use
---------------

[](#zero-config-use)

If you don't need any custom completion behaviour, you can simply add the completion command to your application:

1. Install `stecman/symfony-console-completion` using [composer](https://getcomposer.org/) by running:

    ```
    $ composer require stecman/symfony-console-completion

    ```
2. For standalone Symfony Console applications, add an instance of `CompletionCommand` to your application's `Application::getDefaultCommands()` method:

    ```
    protected function getDefaultCommands()
    {
       //...
        $commands[] = new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand();
       //...
    }
    ```

    For Symfony Framework applications, register the `CompletionCommand` as a service in `app/config/services.yml`:

    ```
    services:
    #...
        console.completion_command:
          class: Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand
          tags:
              -  { name: console.command }
    #...
    ```
3. Register completion for your application by running one of the following in a terminal, replacing `[program]` with the command you use to run your application (eg. 'composer'):

    ```
    # BASH ~4.x, ZSH
    source addHandler(
    new Completion(
        Completion::ALL_COMMANDS,
        'package',
        Completion::ALL_TYPES,
        function() {
            // ...
        }
    )
);
```

Example completions
-------------------

[](#example-completions)

### Completing references from a Git repository

[](#completing-references-from-a-git-repository)

```
new Completion(
    Completion::ALL_COMMANDS,
    'ref',
    Completion::TYPE_OPTION,
    function () {
        $raw = shell_exec('git show-ref --abbr');
        if (preg_match_all('/refs\/(?:heads|tags)?\/?(.*)/', $raw, $matches)) {
            return $matches[1];
        }
    }
)
```

### Completing filesystem paths

[](#completing-filesystem-paths)

This library provides the completion implementation `ShellPathCompletion` which defers path completion to the shell's built-in path completion behaviour rather than implementing it in PHP, so that users get the path completion behaviour they expect from their shell.

```
new Completion\ShellPathCompletion(
    Completion::ALL_COMMANDS,
    'path',
    Completion::TYPE_OPTION
)
```

Behaviour notes
---------------

[](#behaviour-notes)

- Option shortcuts are not offered as completion options, however requesting completion (ie. pressing tab) on a valid option shortcut will complete.
- Completion is not implemented for the `--option="value"` style of passing a value to an option, however `--option value` and `--option "value"` work and are functionally identical.
- Value completion is always run for options marked as `InputOption::VALUE_OPTIONAL` since there is currently no way to determine the desired behaviour from the command line contents (ie. skip the optional value or complete for it)

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance75

Regular maintenance activity

Popularity66

Solid adoption and visibility

Community41

Growing community involvement

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 76.3% 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

Every ~169 days

Recently: every ~222 days

Total

28

Last Release

170d ago

PHP version history (3 changes)0.5.0PHP &gt;=5.3.2

v0.12.0PHP &gt;=8.0.2

v0.14.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0795b20d769be43846f69ead3fdd425bf441df2f0877f15e361bab5f7e039036?d=identicon)[stecman](/maintainers/stecman)

---

Top Contributors

[![stecman](https://avatars.githubusercontent.com/u/2230769?v=4)](https://github.com/stecman "stecman (129 commits)")[![duncan3dc](https://avatars.githubusercontent.com/u/546811?v=4)](https://github.com/duncan3dc "duncan3dc (8 commits)")[![VolCh](https://avatars.githubusercontent.com/u/396345?v=4)](https://github.com/VolCh "VolCh (5 commits)")[![rajeshreeputra](https://avatars.githubusercontent.com/u/19570710?v=4)](https://github.com/rajeshreeputra "rajeshreeputra (5 commits)")[![nickvergessen](https://avatars.githubusercontent.com/u/213943?v=4)](https://github.com/nickvergessen "nickvergessen (4 commits)")[![asika32764](https://avatars.githubusercontent.com/u/1639206?v=4)](https://github.com/asika32764 "asika32764 (3 commits)")[![pjcdawkins](https://avatars.githubusercontent.com/u/1465106?v=4)](https://github.com/pjcdawkins "pjcdawkins (3 commits)")[![W0rma](https://avatars.githubusercontent.com/u/20659830?v=4)](https://github.com/W0rma "W0rma (2 commits)")[![mhor](https://avatars.githubusercontent.com/u/4103719?v=4)](https://github.com/mhor "mhor (1 commits)")[![Programie](https://avatars.githubusercontent.com/u/1206521?v=4)](https://github.com/Programie "Programie (1 commits)")[![k0pernikus](https://avatars.githubusercontent.com/u/436935?v=4)](https://github.com/k0pernikus "k0pernikus (1 commits)")[![balsama](https://avatars.githubusercontent.com/u/1536654?v=4)](https://github.com/balsama "balsama (1 commits)")[![CarsonF](https://avatars.githubusercontent.com/u/932566?v=4)](https://github.com/CarsonF "CarsonF (1 commits)")[![Chronoes](https://avatars.githubusercontent.com/u/9286920?v=4)](https://github.com/Chronoes "Chronoes (1 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (1 commits)")[![GwendolenLynch](https://avatars.githubusercontent.com/u/1427081?v=4)](https://github.com/GwendolenLynch "GwendolenLynch (1 commits)")[![helhum](https://avatars.githubusercontent.com/u/904370?v=4)](https://github.com/helhum "helhum (1 commits)")[![AlexeyKosov](https://avatars.githubusercontent.com/u/8222004?v=4)](https://github.com/AlexeyKosov "AlexeyKosov (1 commits)")

---

Tags

bashcompletionphpshellsymfony-consoletab-completionzsh

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stecman-symfony-console-completion/health.svg)

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

###  Alternatives

[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[crazywhalecc/static-php-cli

Build single static PHP binary, with PHP project together, with popular extensions included.

1.8k13.9k](/packages/crazywhalecc-static-php-cli)[matthiasnoback/symfony-console-form

Use Symfony forms for Console command input

368264.8k8](/packages/matthiasnoback-symfony-console-form)[phpcr/phpcr-shell

Shell for PHPCR

721.3M8](/packages/phpcr-phpcr-shell)[madewithlove/license-checker

CLI tool to verify allowed licenses for composer dependencies

54449.8k21](/packages/madewithlove-license-checker)[shel/neos-terminal

Neos CMS Ui terminal for running Eel expressions and other commands

1441.3k](/packages/shel-neos-terminal)

PHPackages © 2026

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