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

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

tobento/app-console
===================

App console support.

2.0(5mo ago)01502MITPHPPHP &gt;=8.4

Since Nov 1Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/tobento-ch/app-console)[ Packagist](https://packagist.org/packages/tobento/app-console)[ Docs](https://www.tobento.ch)[ RSS](/packages/tobento-app-console/feed)WikiDiscussions 2.x Synced today

READMEChangelog (4)Dependencies (6)Versions (6)Used By (2)

App Console
===========

[](#app-console)

Console support for the app using the [Console Service](https://github.com/tobento-ch/service-console).

Table of Contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
    - [Requirements](#requirements)
- [Documentation](#documentation)
    - [App](#app)
    - [Console Boot](#console-boot)
        - [Creating Commands](#creating-commands)
        - [Adding Commands](#adding-commands)
        - [Invoke Commands](#invoke-commands)
- [Credits](#credits)

---

Getting Started
===============

[](#getting-started)

Add the latest version of the app console project running this command.

```
composer require tobento/app-console

```

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

[](#requirements)

- PHP 8.4 or greater

Documentation
=============

[](#documentation)

App
---

[](#app)

Check out the [**App Skeleton**](https://github.com/tobento-ch/app-skeleton) if you are using the skeleton.

You may also check out the [**App**](https://github.com/tobento-ch/app) to learn more about the app in general.

Console Boot
------------

[](#console-boot)

The console boot does the following:

- creates app file in the root directory if not exist
- implements console interfaces

```
use Tobento\App\AppFactory;
use Tobento\Service\Console\ConsoleInterface;
use Tobento\Service\Console\ConsoleFactoryInterface;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');

// Adding boots
$app->boot(\Tobento\App\Console\Boot\Console::class);
$app->booting();

// Implemented interfaces:
$consoleFactory = $app->get(ConsoleFactoryInterface::class);
$console = $app->get(ConsoleInterface::class);

// Run the app
$app->run();
```

If you are not using the [App Skeleton](https://github.com/tobento-ch/app-skeleton/) you may adjust the `ap` file in the root directory with the path to your app:

```
// Get and run the application.
// (require __DIR__.'/app/app.php')->run();
(require __DIR__.'/path/to/app.php')->run();
```

### Creating Commands

[](#creating-commands)

Check out the [Console Service - Creating Commands](https://github.com/tobento-ch/service-console#creating-commands) section to learn more about creating commands.

### Adding Commands

[](#adding-commands)

You can add commands in severval ways:

**Using the app**

You may use the app `on` method to register commands only if the console is requested.

```
use Tobento\App\AppFactory;
use Tobento\Service\Console\ConsoleInterface;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');

// Adding boots:
$app->boot(\Tobento\App\Console\Boot\Console::class);

// Adding commands:
$app->on(ConsoleInterface::class, function(ConsoleInterface $console) {
    $console->addCommand($command);
});

// Run the app
$app->run();
```

**Using the console boot**

```
use Tobento\App\Boot;
use Tobento\App\Console\Boot\Console;

class AnyServiceBoot extends Boot
{
    public const BOOT = [
        // you may ensure the console boot.
        Console::class,
    ];

    public function boot(Console $console)
    {
        // you may add commands only if running in console:
        if ($console->runningInConsole()) {
            $console->addCommand($command);
        }
    }
}
```

### Invoke Commands

[](#invoke-commands)

To invoke application command just run:

```
php ap command:name

```

To get a list of available commands:

```
php ap list

```

Credits
=======

[](#credits)

- [Tobias Strub](https://www.tobento.ch)
- [All Contributors](../../contributors)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance70

Regular maintenance activity

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

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 ~140 days

Recently: every ~164 days

Total

6

Last Release

171d ago

Major Versions

1.x-dev → 2.02025-10-01

PHP version history (2 changes)1.0.0PHP &gt;=8.0

2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/055d6a1b5c2384bb179c75ab0b55914231d898fdc4dffeb30770f81200e52206?d=identicon)[TOBENTOch](/maintainers/TOBENTOch)

---

Top Contributors

[![tobento-ch](https://avatars.githubusercontent.com/u/16684832?v=4)](https://github.com/tobento-ch "tobento-ch (11 commits)")

---

Tags

consolepackageapptobento

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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