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

istyle-inc/console-with-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages