console.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Loader\Configurator;
  11. use Symfony\Bundle\FrameworkBundle\Command\AboutCommand;
  12. use Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand;
  13. use Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand;
  14. use Symfony\Bundle\FrameworkBundle\Command\CachePoolClearCommand;
  15. use Symfony\Bundle\FrameworkBundle\Command\CachePoolDeleteCommand;
  16. use Symfony\Bundle\FrameworkBundle\Command\CachePoolListCommand;
  17. use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
  18. use Symfony\Bundle\FrameworkBundle\Command\CacheWarmupCommand;
  19. use Symfony\Bundle\FrameworkBundle\Command\ConfigDebugCommand;
  20. use Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand;
  21. use Symfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand;
  22. use Symfony\Bundle\FrameworkBundle\Command\ContainerLintCommand;
  23. use Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand;
  24. use Symfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand;
  25. use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
  26. use Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
  27. use Symfony\Bundle\FrameworkBundle\Command\SecretsDecryptToLocalCommand;
  28. use Symfony\Bundle\FrameworkBundle\Command\SecretsEncryptFromLocalCommand;
  29. use Symfony\Bundle\FrameworkBundle\Command\SecretsGenerateKeysCommand;
  30. use Symfony\Bundle\FrameworkBundle\Command\SecretsListCommand;
  31. use Symfony\Bundle\FrameworkBundle\Command\SecretsRemoveCommand;
  32. use Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand;
  33. use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
  34. use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
  35. use Symfony\Bundle\FrameworkBundle\Command\WorkflowDumpCommand;
  36. use Symfony\Bundle\FrameworkBundle\Command\YamlLintCommand;
  37. use Symfony\Bundle\FrameworkBundle\EventListener\SuggestMissingPackageSubscriber;
  38. use Symfony\Component\Console\EventListener\ErrorListener;
  39. use Symfony\Component\Messenger\Command\ConsumeMessagesCommand;
  40. use Symfony\Component\Messenger\Command\DebugCommand;
  41. use Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand;
  42. use Symfony\Component\Messenger\Command\FailedMessagesRetryCommand;
  43. use Symfony\Component\Messenger\Command\FailedMessagesShowCommand;
  44. use Symfony\Component\Messenger\Command\SetupTransportsCommand;
  45. use Symfony\Component\Messenger\Command\StopWorkersCommand;
  46. use Symfony\Component\Translation\Command\XliffLintCommand;
  47. use Symfony\Component\Validator\Command\DebugCommand as ValidatorDebugCommand;
  48. return static function (ContainerConfigurator $container) {
  49. $container->services()
  50. ->set('console.error_listener', ErrorListener::class)
  51. ->args([
  52. service('logger')->nullOnInvalid(),
  53. ])
  54. ->tag('kernel.event_subscriber')
  55. ->tag('monolog.logger', ['channel' => 'console'])
  56. ->set('console.suggest_missing_package_subscriber', SuggestMissingPackageSubscriber::class)
  57. ->tag('kernel.event_subscriber')
  58. ->set('console.command.about', AboutCommand::class)
  59. ->tag('console.command', ['command' => 'about'])
  60. ->set('console.command.assets_install', AssetsInstallCommand::class)
  61. ->args([
  62. service('filesystem'),
  63. param('kernel.project_dir'),
  64. ])
  65. ->tag('console.command', ['command' => 'assets:install'])
  66. ->set('console.command.cache_clear', CacheClearCommand::class)
  67. ->args([
  68. service('cache_clearer'),
  69. service('filesystem'),
  70. ])
  71. ->tag('console.command', ['command' => 'cache:clear'])
  72. ->set('console.command.cache_pool_clear', CachePoolClearCommand::class)
  73. ->args([
  74. service('cache.global_clearer'),
  75. ])
  76. ->tag('console.command', ['command' => 'cache:pool:clear'])
  77. ->set('console.command.cache_pool_prune', CachePoolPruneCommand::class)
  78. ->args([
  79. [],
  80. ])
  81. ->tag('console.command', ['command' => 'cache:pool:prune'])
  82. ->set('console.command.cache_pool_delete', CachePoolDeleteCommand::class)
  83. ->args([
  84. service('cache.global_clearer'),
  85. ])
  86. ->tag('console.command', ['command' => 'cache:pool:delete'])
  87. ->set('console.command.cache_pool_list', CachePoolListCommand::class)
  88. ->args([
  89. null,
  90. ])
  91. ->tag('console.command', ['command' => 'cache:pool:list'])
  92. ->set('console.command.cache_warmup', CacheWarmupCommand::class)
  93. ->args([
  94. service('cache_warmer'),
  95. ])
  96. ->tag('console.command', ['command' => 'cache:warmup'])
  97. ->set('console.command.config_debug', ConfigDebugCommand::class)
  98. ->tag('console.command', ['command' => 'debug:config'])
  99. ->set('console.command.config_dump_reference', ConfigDumpReferenceCommand::class)
  100. ->tag('console.command', ['command' => 'config:dump-reference'])
  101. ->set('console.command.container_debug', ContainerDebugCommand::class)
  102. ->tag('console.command', ['command' => 'debug:container'])
  103. ->set('console.command.container_lint', ContainerLintCommand::class)
  104. ->tag('console.command', ['command' => 'lint:container'])
  105. ->set('console.command.debug_autowiring', DebugAutowiringCommand::class)
  106. ->args([
  107. null,
  108. service('debug.file_link_formatter')->nullOnInvalid(),
  109. ])
  110. ->tag('console.command', ['command' => 'debug:autowiring'])
  111. ->set('console.command.event_dispatcher_debug', EventDispatcherDebugCommand::class)
  112. ->args([
  113. service('event_dispatcher'),
  114. ])
  115. ->tag('console.command', ['command' => 'debug:event-dispatcher'])
  116. ->set('console.command.messenger_consume_messages', ConsumeMessagesCommand::class)
  117. ->args([
  118. abstract_arg('Routable message bus'),
  119. service('messenger.receiver_locator'),
  120. service('event_dispatcher'),
  121. service('logger')->nullOnInvalid(),
  122. [], // Receiver names
  123. ])
  124. ->tag('console.command', ['command' => 'messenger:consume'])
  125. ->tag('monolog.logger', ['channel' => 'messenger'])
  126. ->set('console.command.messenger_setup_transports', SetupTransportsCommand::class)
  127. ->args([
  128. service('messenger.receiver_locator'),
  129. [], // Receiver names
  130. ])
  131. ->tag('console.command', ['command' => 'messenger:setup-transports'])
  132. ->set('console.command.messenger_debug', DebugCommand::class)
  133. ->args([
  134. [], // Message to handlers mapping
  135. ])
  136. ->tag('console.command', ['command' => 'debug:messenger'])
  137. ->set('console.command.messenger_stop_workers', StopWorkersCommand::class)
  138. ->args([
  139. service('cache.messenger.restart_workers_signal'),
  140. ])
  141. ->tag('console.command', ['command' => 'messenger:stop-workers'])
  142. ->set('console.command.messenger_failed_messages_retry', FailedMessagesRetryCommand::class)
  143. ->args([
  144. abstract_arg('Receiver name'),
  145. abstract_arg('Receiver'),
  146. service('messenger.routable_message_bus'),
  147. service('event_dispatcher'),
  148. service('logger'),
  149. ])
  150. ->tag('console.command', ['command' => 'messenger:failed:retry'])
  151. ->set('console.command.messenger_failed_messages_show', FailedMessagesShowCommand::class)
  152. ->args([
  153. abstract_arg('Receiver name'),
  154. abstract_arg('Receiver'),
  155. ])
  156. ->tag('console.command', ['command' => 'messenger:failed:show'])
  157. ->set('console.command.messenger_failed_messages_remove', FailedMessagesRemoveCommand::class)
  158. ->args([
  159. abstract_arg('Receiver name'),
  160. abstract_arg('Receiver'),
  161. ])
  162. ->tag('console.command', ['command' => 'messenger:failed:remove'])
  163. ->set('console.command.router_debug', RouterDebugCommand::class)
  164. ->args([
  165. service('router'),
  166. service('debug.file_link_formatter')->nullOnInvalid(),
  167. ])
  168. ->tag('console.command', ['command' => 'debug:router'])
  169. ->set('console.command.router_match', RouterMatchCommand::class)
  170. ->args([
  171. service('router'),
  172. tagged_iterator('routing.expression_language_provider'),
  173. ])
  174. ->tag('console.command', ['command' => 'router:match'])
  175. ->set('console.command.translation_debug', TranslationDebugCommand::class)
  176. ->args([
  177. service('translator'),
  178. service('translation.reader'),
  179. service('translation.extractor'),
  180. param('translator.default_path'),
  181. null, // twig.default_path
  182. [], // Translator paths
  183. [], // Twig paths
  184. ])
  185. ->tag('console.command', ['command' => 'debug:translation'])
  186. ->set('console.command.translation_update', TranslationUpdateCommand::class)
  187. ->args([
  188. service('translation.writer'),
  189. service('translation.reader'),
  190. service('translation.extractor'),
  191. param('kernel.default_locale'),
  192. param('translator.default_path'),
  193. null, // twig.default_path
  194. [], // Translator paths
  195. [], // Twig paths
  196. ])
  197. ->tag('console.command', ['command' => 'translation:update'])
  198. ->set('console.command.validator_debug', ValidatorDebugCommand::class)
  199. ->args([
  200. service('validator'),
  201. ])
  202. ->tag('console.command', ['command' => 'debug:validator'])
  203. ->set('console.command.workflow_dump', WorkflowDumpCommand::class)
  204. ->tag('console.command', ['command' => 'workflow:dump'])
  205. ->set('console.command.xliff_lint', XliffLintCommand::class)
  206. ->tag('console.command', ['command' => 'lint:xliff'])
  207. ->set('console.command.yaml_lint', YamlLintCommand::class)
  208. ->tag('console.command', ['command' => 'lint:yaml'])
  209. ->set('console.command.form_debug', \Symfony\Component\Form\Command\DebugCommand::class)
  210. ->args([
  211. service('form.registry'),
  212. [], // All form types namespaces are stored here by FormPass
  213. [], // All services form types are stored here by FormPass
  214. [], // All type extensions are stored here by FormPass
  215. [], // All type guessers are stored here by FormPass
  216. service('debug.file_link_formatter')->nullOnInvalid(),
  217. ])
  218. ->tag('console.command', ['command' => 'debug:form'])
  219. ->set('console.command.secrets_set', SecretsSetCommand::class)
  220. ->args([
  221. service('secrets.vault'),
  222. service('secrets.local_vault')->nullOnInvalid(),
  223. ])
  224. ->tag('console.command', ['command' => 'secrets:set'])
  225. ->set('console.command.secrets_remove', SecretsRemoveCommand::class)
  226. ->args([
  227. service('secrets.vault'),
  228. service('secrets.local_vault')->nullOnInvalid(),
  229. ])
  230. ->tag('console.command', ['command' => 'secrets:remove'])
  231. ->set('console.command.secrets_generate_key', SecretsGenerateKeysCommand::class)
  232. ->args([
  233. service('secrets.vault'),
  234. service('secrets.local_vault')->ignoreOnInvalid(),
  235. ])
  236. ->tag('console.command', ['command' => 'secrets:generate-keys'])
  237. ->set('console.command.secrets_list', SecretsListCommand::class)
  238. ->args([
  239. service('secrets.vault'),
  240. service('secrets.local_vault'),
  241. ])
  242. ->tag('console.command', ['command' => 'secrets:list'])
  243. ->set('console.command.secrets_decrypt_to_local', SecretsDecryptToLocalCommand::class)
  244. ->args([
  245. service('secrets.vault'),
  246. service('secrets.local_vault')->ignoreOnInvalid(),
  247. ])
  248. ->tag('console.command', ['command' => 'secrets:decrypt-to-local'])
  249. ->set('console.command.secrets_encrypt_from_local', SecretsEncryptFromLocalCommand::class)
  250. ->args([
  251. service('secrets.vault'),
  252. service('secrets.local_vault'),
  253. ])
  254. ->tag('console.command', ['command' => 'secrets:encrypt-from-local'])
  255. ;
  256. };