2017-01-18 3 views
0

symfony new <prj_name>でプロジェクトを開始する代わりに、composer require symfony/consoleを使用しました。 generateコマンドにアクセスできません。symfony newを使ってコンソール専用プロジェクトを作成することはできますか?

これは間違っていますか? composer requireを使用すると、最初のビン/コンソールの作成をどのように自動化できますか?

はSensioバンドルが必要::

$ composer require sensio/generator-bundle 

その後、私は唯一のcomposer require symfony/consoleを使用して開始し、手動でconsole.phpファイルを作成する必要がありました、私は次のようでした既存のプロジェクトでそう

+0

https://www.sitepoint.com/command-line-php-using-symfony-console/ – Veve

+0

http://symfony.com/doc/current/components/console.html – Veve

答えて

0

、console.phpで、Sensio Bundle

. 
. 
. 
use Sensio\Bundle\GeneratorBundle\Command\GenerateCommandCommand; 
. 
. 
. 
$console->add(new GenerateCommandCommand()); 

これを実行すると、 console.phpファイルでは、ヘルプテキストにそのコマンドへのリンクが表示されます。

$ php console.php 
Console Tool 

Usage: 
    command [options] [arguments] 

Options: 
    -h, --help   Display this help message 
    -q, --quiet   Do not output any message 
    -V, --version   Display this application version 
     --ansi   Force ANSI output 
     --no-ansi   Disable ANSI output 
    -n, --no-interaction Do not ask any interactive question 
    -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 

Available commands: 
    help    Displays help for a command 
    list    Lists commands 
generate 
    generate:command Generates a console command 
関連する問題