创建新的组件

Hyperf 官方提供了工具来快速创建组件包。

  1. composer create-project hyperf/component-creater your_component dev-master

执行结果如下:

  1. $ composer create-project hyperf/component-creater your_component dev-master
  2. Installing hyperf/component-creater (dev-master 2a626139a08be9cc3b23e9f03592ccf1b7d3158a)
  3. - Installing hyperf/component-creater (dev-master 2a62613): Cloning 2a626139a0 from cache
  4. Created project in your_component
  5. > Installer\Script::install
  6. Setting up optional packages
  7. What is your component name (hyperf/demo): sample/component
  8. What is your component license (MIT) : MIT
  9. What is your component description : Sample Component
  10. What is your namespace (Sample\Component): Sample\Component
  11. Removing installer development dependencies
  12. Do you want to use hyperf/framework component ?
  13. [1] yes
  14. [n] None of the above
  15. Make your selection or type a composer package name and version (n): 1
  16. - Adding package hyperf/framework (1.0.*)
  17. Do you want to use hyperf/di component ?
  18. [1] yes
  19. [n] None of the above
  20. Make your selection or type a composer package name and version (n): 1
  21. - Adding package hyperf/di (1.0.*)
  22. Remove installer
  23. Adding .gitattributes
  24. Removing Expressive installer classes, configuration, tests and docs
  25. Loading composer repositories with package information
  26. Updating dependencies (including require-dev)
  27. Package operations: 85 installs, 0 updates, 0 removals
  28. - Installing ocramius/package-versions (1.4.0): Loading from cache
  29. - Installing swoft/swoole-ide-helper (dev-master 9de6d57): Cloning 9de6d57310 from cache
  30. - Installing doctrine/inflector (v1.3.0): Loading from cache
  31. - Installing psr/log (1.1.0): Loading from cache
  32. - Installing psr/event-dispatcher (1.0.0): Loading from cache
  33. - Installing psr/container (1.0.0): Loading from cache
  34. - Installing hyperf/contract (v1.0.6): Loading from cache
  35. - Installing hyperf/utils (v1.0.6): Loading from cache
  36. - Installing psr/http-message (1.0.1): Loading from cache
  37. - Installing fig/http-message-util (1.1.3): Loading from cache
  38. - Installing hyperf/framework (v1.0.6): Loading from cache
  39. - Installing psr/http-server-handler (1.0.1): Loading from cache
  40. - Installing psr/http-server-middleware (1.0.1): Loading from cache
  41. - Installing hyperf/dispatcher (v1.0.6): Loading from cache
  42. - Installing hyperf/di (v1.0.6): Loading from cache
  43. - Installing hyperf/event (v1.0.5): Loading from cache
  44. - Installing doctrine/instantiator (1.2.0): Loading from cache
  45. - Installing php-di/phpdoc-reader (2.1.0): Loading from cache
  46. - Installing symfony/finder (v4.3.3): Loading from cache
  47. - Installing doctrine/lexer (1.0.2): Loading from cache
  48. - Installing doctrine/annotations (v1.6.1): Loading from cache
  49. - Installing nikic/php-parser (v4.2.2): Loading from cache
  50. - Installing symfony/service-contracts (v1.1.5): Loading from cache
  51. - Installing symfony/polyfill-php73 (v1.11.0): Loading from cache
  52. - Installing symfony/polyfill-mbstring (v1.11.0): Loading from cache
  53. - Installing symfony/console (v4.3.3): Loading from cache
  54. - Installing symfony/stopwatch (v4.3.3): Loading from cache
  55. - Installing symfony/process (v4.3.3): Loading from cache
  56. - Installing symfony/polyfill-php72 (v1.11.0): Loading from cache
  57. - Installing paragonie/random_compat (v9.99.99): Loading from cache
  58. - Installing symfony/polyfill-php70 (v1.11.0): Loading from cache
  59. - Installing symfony/options-resolver (v4.3.3): Loading from cache
  60. - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
  61. - Installing symfony/filesystem (v4.3.3): Loading from cache
  62. - Installing symfony/event-dispatcher-contracts (v1.1.5): Loading from cache
  63. - Installing symfony/event-dispatcher (v4.3.3): Loading from cache
  64. - Installing php-cs-fixer/diff (v1.3.0): Loading from cache
  65. - Installing composer/xdebug-handler (1.3.3): Loading from cache
  66. - Installing composer/semver (1.5.0): Loading from cache
  67. - Installing friendsofphp/php-cs-fixer (v2.15.1): Loading from cache
  68. - Installing hyperf/server (v1.0.6): Loading from cache
  69. - Installing zendframework/zend-stdlib (3.2.1): Loading from cache
  70. - Installing zendframework/zend-mime (2.7.1): Loading from cache
  71. - Installing hyperf/http-message (v1.0.6): Loading from cache
  72. - Installing hyperf/exception-handler (v1.0.1): Loading from cache
  73. - Installing nikic/fast-route (v1.3.0): Loading from cache
  74. - Installing hyperf/http-server (v1.0.6): Loading from cache
  75. - Installing sebastian/version (2.0.1): Loading from cache
  76. - Installing sebastian/resource-operations (2.0.1): Loading from cache
  77. - Installing sebastian/recursion-context (3.0.0): Loading from cache
  78. - Installing sebastian/object-reflector (1.1.1): Loading from cache
  79. - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  80. - Installing sebastian/global-state (2.0.0): Loading from cache
  81. - Installing sebastian/exporter (3.1.0): Loading from cache
  82. - Installing sebastian/environment (4.2.2): Loading from cache
  83. - Installing sebastian/diff (3.0.2): Loading from cache
  84. - Installing sebastian/comparator (3.0.2): Loading from cache
  85. - Installing phpunit/php-timer (2.1.2): Loading from cache
  86. - Installing phpunit/php-text-template (1.2.1): Loading from cache
  87. - Installing phpunit/php-file-iterator (2.0.2): Loading from cache
  88. - Installing theseer/tokenizer (1.1.3): Loading from cache
  89. - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  90. - Installing phpunit/php-token-stream (3.1.0): Loading from cache
  91. - Installing phpunit/php-code-coverage (6.1.4): Loading from cache
  92. - Installing webmozart/assert (1.4.0): Loading from cache
  93. - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  94. - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  95. - Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
  96. - Installing phpspec/prophecy (1.8.1): Loading from cache
  97. - Installing phar-io/version (2.0.1): Loading from cache
  98. - Installing phar-io/manifest (1.0.3): Loading from cache
  99. - Installing myclabs/deep-copy (1.9.1): Loading from cache
  100. - Installing phpunit/phpunit (7.5.14): Loading from cache
  101. - Installing hyperf/testing (v1.0.2): Loading from cache
  102. - Installing phpstan/phpdoc-parser (0.3.5): Loading from cache
  103. - Installing nette/utils (v3.0.1): Loading from cache
  104. - Installing nette/finder (v2.5.0): Loading from cache
  105. - Installing nette/robot-loader (v3.2.0): Loading from cache
  106. - Installing nette/schema (v1.0.0): Loading from cache
  107. - Installing nette/php-generator (v3.2.3): Loading from cache
  108. - Installing nette/neon (v3.0.0): Loading from cache
  109. - Installing nette/di (v3.0.0): Loading from cache
  110. - Installing nette/bootstrap (v3.0.0): Loading from cache
  111. - Installing jean85/pretty-package-versions (1.2): Loading from cache
  112. - Installing phpstan/phpstan (0.10.8): Loading from cache
  113. hyperf/utils suggests installing symfony/var-dumper (Required to use the dd function (^4.1).)
  114. hyperf/framework suggests installing hyperf/command (Required to use Command annotation.)
  115. hyperf/di suggests installing hyperf/config (Require this component for annotation scan progress to retrieve the scan path.)
  116. symfony/service-contracts suggests installing symfony/service-implementation
  117. symfony/console suggests installing symfony/lock
  118. paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
  119. symfony/event-dispatcher suggests installing symfony/dependency-injection
  120. symfony/event-dispatcher suggests installing symfony/http-kernel
  121. friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-isidenticalstring (For IsIdenticalString constraint.)
  122. friendsofphp/php-cs-fixer suggests installing php-cs-fixer/phpunit-constraint-xmlmatchesxsd (For XmlMatchesXsd constraint.)
  123. zendframework/zend-mime suggests installing zendframework/zend-mail (Zend\Mail component)
  124. sebastian/global-state suggests installing ext-uopz (*)
  125. phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
  126. phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
  127. phpunit/phpunit suggests installing ext-xdebug (*)
  128. nette/bootstrap suggests installing tracy/tracy (to use Configurator::enableTracy())
  129. Writing lock file
  130. Generating autoload files
  131. ocramius/package-versions: Generating version class...
  132. ocramius/package-versions: ...done generating version class
  133. Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? Y