PHPackages                             yiisoft/yii-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. [Framework](/categories/framework)
4. /
5. yiisoft/yii-console

ActiveLibrary[Framework](/categories/framework)

yiisoft/yii-console
===================

Symfony console wrapper with additional features

2.4.2(5mo ago)70400.2k—7%31[6 issues](https://github.com/yiisoft/yii-console/issues)[1 PRs](https://github.com/yiisoft/yii-console/pulls)20BSD-3-ClausePHPPHP 8.0 - 8.5CI passing

Since Nov 1Pushed 5mo ago20 watchersCompare

[ Source](https://github.com/yiisoft/yii-console)[ Packagist](https://packagist.org/packages/yiisoft/yii-console)[ Docs](https://www.yiiframework.com/)[ GitHub Sponsors](https://github.com/sponsors/yiisoft)[ OpenCollective](https://opencollective.com/yiisoft)[ RSS](/packages/yiisoft-yii-console/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (19)Used By (20)

 [ ![Yii](https://camo.githubusercontent.com/8317c17418b39410a660f5149071d26c5023c0d5fb2b7ebb771324812f666d73/68747470733a2f2f796969736f66742e6769746875622e696f2f646f63732f696d616765732f7969695f6c6f676f2e737667) ](https://github.com/yiisoft)

Yii Console
===========

[](#yii-console)

[![Latest Stable Version](https://camo.githubusercontent.com/342b7da9bca020ff4bc7f9e398f8f0a1b0d66d724f9b2860b3aaa7bfa78db92c/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f7969692d636f6e736f6c652f76)](https://packagist.org/packages/yiisoft/yii-console)[![Total Downloads](https://camo.githubusercontent.com/6b65a3c93d7027e594b3122e0e777575628b23a4e1cc05cb0f40f04b26c034e5/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f7969692d636f6e736f6c652f646f776e6c6f616473)](https://packagist.org/packages/yiisoft/yii-console)[![Build status](https://github.com/yiisoft/yii-console/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/yii-console/actions/workflows/build.yml)[![Code Coverage](https://camo.githubusercontent.com/e4c7c57dd17fc0a903037225309058a6959c035ba3625ff1aea1e430c1720b45/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f7969692d636f6e736f6c652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/yii-console)[![Mutation testing badge](https://camo.githubusercontent.com/7b696fc41419e8d203408a4453bb9d5d0ceef8dd585b5fa58233833ca2761103/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246796969736f66742532467969692d636f6e736f6c652532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/yii-console/master)[![static analysis](https://github.com/yiisoft/yii-console/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/yii-console/actions?query=workflow%3A%22static+analysis%22)[![type-coverage](https://camo.githubusercontent.com/3c844873665119f48db811a3cd19f2fcc6b90bc7f9a149c9c1e159e12ec37295/68747470733a2f2f73686570686572642e6465762f6769746875622f796969736f66742f7969692d636f6e736f6c652f636f7665726167652e737667)](https://shepherd.dev/github/yiisoft/yii-console)

Yii Console package provides a console that could be added to an application. This console is based on [Symfony Console](https://github.com/symfony/console). The following extra features are added:

- lazy command loader;
- `SymfonyEventDispatcher` class that allows to use any [PSR-14](https://www.php-fig.org/psr/psr-14/) compatible event dispatcher with Symfony console;
- `ErrorListener` for logging console errors to any [PSR-3](https://www.php-fig.org/psr/psr-3/) compatible logger;
- console command `serve` that runs PHP built-in web server;
- raises events `ApplicationStartup` and `ApplicationShutdown` in console application;
- class `ExitCode` that contains constants for defining console command exit codes;
- `ConsoleBufferedOutput` that wraps `ConsoleOutput` and buffers console output.

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

[](#requirements)

- PHP 8.0 - 8.5.

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

[](#installation)

The package could be installed with [Composer](https://getcomposer.org):

```
composer require yiisoft/yii-console
```

General usage
-------------

[](#general-usage)

In case you use one of Yii 3 standard application templates, console could be accessed as `./yii `.

If not, then in the simplest use case in your console entry script do the following:

```
#!/usr/bin/env php
