PHPackages                             circli/console - 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. circli/console

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

circli/console
==============

wrapper around symfony console to better support containers

2.3.0(1y ago)015.1k↓44.7%2MITPHPPHP ^8.1

Since Jul 21Pushed 1y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (4)Versions (9)Used By (2)

Circli Console - Wrapper around symfony console
===============================================

[](#circli-console---wrapper-around-symfony-console)

[![Latest Version](https://camo.githubusercontent.com/02e74561453c8693fd0fc33c328fe01b975057bbc54a63f3420ad1f61f9103fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636972636c692f636f6e736f6c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/circli/console/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://github.com/circli/console/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/circli/console/actions/workflows/unit-tests.yml)[![Coverage Status](https://camo.githubusercontent.com/333efd851535bca4b216377698e722a4738f79dfb1f32c3efea16c9930edb23d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f636972636c692f636f6e736f6c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/circli/console?branch=master)

I created this package to have a more lightweight initialization of symfony console applications. It's a bit annoying if a class dose auto connect to something remote, and it needs todo that when you list the commands or run something not connected to the remote service. So I split the definition and command into 2 parts one for the definition and one for the command. And the command is not initialized until it's needed.

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

[](#installation)

```
composer require circli/console

```

Usage
-----

[](#usage)

#### Definition

[](#definition)

The definition object handles everything related to how the command is called. And **must** extend `\Circli\Console\Definition`.

#### Command

[](#command)

The command can be anything `callable` and **must** return an integer.

So any class you want to use as a command need to implement `__invoke(InputInterface $input, OutputInterface $output): int`.

### Most basic definition

[](#most-basic-definition)

```
class ExampleCommandDefinition extends \Circli\Console\Definition
{
    protected function configure(): void
    {
        $this->setName('example:command');
        $this->setCommand(function($input, $output) {
            return 0;
        });
    }
}

$application = new Application();
$application->addDefinition(new ExampleCommandDefinition());

$application->run();
```

### Using custom input

[](#using-custom-input)

You can transform input into custom input types to have better type hinting and control over what is passed into a command

```
class ExampleInput extends \Circli\Console\AbstractInput
{
    public function getFrom(): \DateTimeInterface
    {
        $rawDate = $this->getArgument('from') ?: 'now';

        return new \DateTimeImmutable($rawDate);
    }
}

class ExampleCommandDefinition extends \Circli\Console\Definition
{
    protected function configure(): void
    {
        $this->setName('example:command');
        $this->addArgument('from', InputArgument::REQUIRED);
        $this->setCommand(function(ExampleInput $input, $output) {
            $from = $input->getFrom();
            return 0;
        });
    }

    public function transformInput(InputInterface $input, OutputInterface $output): InputInterface
    {
        return new ExampleInput();
    }

}
```

### Using psr container

[](#using-psr-container)

This is a basic implementation to get lazy initialization to work.

If you pass in the container command resolver it will try resolving the command when it's needed.

You can write your own resolver logic if you don't want to pass in the container like this

```
use Circli\Console\Application;
use Circli\Console\ContainerCommandResolver;
use Circli\Console\Definition;

$application = new Application(new ContainerCommandResolver($psr11container));
$application->addDefinition(new class extends Definition {
    protected function configure(): void
    {
        $this->setName('example:command');
        $this->setCommand('keyInContainer');
    }
});
$application->run();
```

### Using with regular Symfony console

[](#using-with-regular-symfony-console)

```
use Symfony\Component\Console\Application;
use Circli\Console\Command;

$application = new Application();
$application->add(new \Circli\Console\Command(new CmdDefinition()));
$application->run();
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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

Every ~266 days

Recently: every ~140 days

Total

7

Last Release

530d ago

Major Versions

1.1.1 → 2.0.02023-10-26

PHP version history (3 changes)1.0.0PHP &gt;=7.3

1.1.0PHP ^7.4 || ^8.0

2.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![sunkan](https://avatars.githubusercontent.com/u/568492?v=4)](https://github.com/sunkan "sunkan (27 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/circli-console/health.svg)

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

###  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)
