Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Writing beautiful command line applications Using The Symfony\Console Component with PSR-11 Container

Container(PSR-11) と Symfony\Console で簡単なコマンドラインアプリケーションを作ってみよう エントリで紹介したサンプルコードリポジトリです

Started

$ composer install

Command

$ php console sample:process

consoleファイルで利用するDependency Inject Containerを変更してみましょう。

/**
 * zend  / aura / league / illuminate
 * 4つのコンテナを入れ替えることができます
 */
$container = $factory->build('zend');
$application->addCommands([
    $container->get(\ConsoleApp\Commands\SampleExecuteCommand::class),
]);

$application->run();

PSR-11準拠のコンテナライブラリを使って、getメソッドを通じてインスタンス生成が行われますが、
インスタンス生成方法について、それぞれのライブラリの違いを学ぶことができます。

好みのライブラリを利用して、簡単なフレームワークや、 テスタブルなアプリケーション作りを!

About

Sample For Writing beautiful command line applications Using The Symfony\Console Component with PSR-11 Container

Topics

Resources

Stars

2 stars

Watchers

35 watching

Forks

Releases

Packages

Contributors

Languages