Zend_Tool_Framework-CliTool.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 16511 -->
  4. <sect1 id="zend.tool.framework.clitool">
  5. <title>CLIツールの使用</title>
  6. <para>
  7. (内部的にコンソール・ツールとして知られる)CLIまたはコマンドライン・ツールは、
  8. 現在、<code>Zend_Tool</code>リクエストをディスパッチするための主要なインターフェースです。
  9. CLIツールで、開発者は「コマンド・ライン・ウインドウ」内でツーリング・リクエストを出すことができます。
  10. それは、「ターミナルの」ウインドウとしても一般に知られています。
  11. この環境は、*nix環境で優れていますが、
  12. Windowsでの<code>cmd.exe</code>やconsole2、更にはCygwinプロジェクトとも共通の実装を持ちます。
  13. </para>
  14. <sect2 id="zend.tool.framework.clitool.setup-general">
  15. <title>CLIツールの設定</title>
  16. <para>
  17. コマンド・ライン・クライアントを通じてツーリング・リクエストを出すために、
  18. システムで「zf」命令を取り扱えるように、
  19. 最初にクライアントを設定する必要があります。
  20. コマンド・ライン・クライアントは、どう見ても、
  21. ゼンド・フレームワーク・ディストリビューションを提供される<code>.sh</code>または<code>.bat</code>ファイルです。
  22. トランクでは、それはここで見つかります:
  23. <ulink url="http://framework.zend.com/svn/framework/standard/trunk/bin/">http://framework.zend.com/svn/framework/standard/trunk/bin/</ulink>
  24. </para>
  25. <para>
  26. ご覧の通り、3つのファイルが、<code>bin/</code>ディレクトリにあります:
  27. <code>zf.php</code>、<code>zf.sh</code>及び<code>zf.bat</code>。
  28. <code>zf.sh</code>および<code>zf.bat</code>は、オペレーティングシステム固有クライアント・ラッパです:
  29. *nix環境のための<code>zf.sh</code>とWin32環境のための<code>zf.bat</code>。
  30. これらのクライアント・ラッパは、適切な<code>php.exe</code>を捜し出して、<code>zf.php</code>を捜し出して、
  31. クライアント・リクエストに渡す役割を果たします。
  32. <code>zf.php</code>は、環境を理解し、適切なinclude_pathを構築して、
  33. ディスパッチするための適切なライブラリ・コンポーネントにコマンド・ラインで提供されるものを渡す
  34. 取扱いに対して責任あるものです。
  35. </para>
  36. <para>
  37. 最後に、あなたのオペレーティングシステムに関係なく、
  38. あなたはすべてを働かせる2つのものを確実にすることを望みます。
  39. </para>
  40. <orderedlist>
  41. <listitem>
  42. <para>
  43. <code>zf.sh/zf.bat</code>は、システム・パスから到達できます。
  44. カレント作業ディレクトリが何かに関係なく、
  45. これはあなたのコマンド・ラインでどこからでも<code>zf</code>を呼ぶ能力です。
  46. </para>
  47. </listitem>
  48. <listitem>
  49. <para>
  50. ZendFramework/libraryは<code>include_path</code>にあります。
  51. </para>
  52. </listitem>
  53. </orderedlist>
  54. <para>
  55. <emphasis>Note:</emphasis> while the above are the most ideal
  56. requirements, you can simply download Zend Framework and expect it
  57. to work as <code>./path/to/zf.php</code> some command.
  58. </para>
  59. </sect2>
  60. <sect2 id="zend.tool.framework.clitool.setup-starnix">
  61. <title>Unixのようなシステム上でCLIツールを設定</title>
  62. <para>
  63. The most common setup in the *nix environment, is to copy the
  64. <code>zf.sh</code> and <code>zf.php</code> into the same directory
  65. as your PHP binary. This can generally be found in one of the
  66. following places:
  67. </para>
  68. <programlisting language="text"><![CDATA[
  69. /usr/bin
  70. /usr/local/bin
  71. /usr/local/ZendServer/bin/
  72. /Applications/ZendServer/bin/
  73. ]]></programlisting>
  74. <para>
  75. To find out the location of your PHP binary, you can execute 'which
  76. php' on the command line. This will return the location of the php
  77. binary you will be using to run php scripts in this environment.
  78. </para>
  79. <para>
  80. The next order of business is to ensure that the Zend Framework
  81. library is setup correctly inside of the system PHP
  82. <code>include_path</code>. To find out where your
  83. <code>include_path</code> is located, you can execute 'php -i' and
  84. look for the <code>include_path</code> variable, or more succinctly,
  85. execute 'php -i | grep include_path'. Once you have found where
  86. your <code>include_path</code> is located (this will generally be
  87. something like /usr/lib/php, /usr/share/php, /usr/local/lib/php, or
  88. similar), ensure that the contents of the library/ directory are put
  89. inside your <code>include_path</code> specified directory.
  90. </para>
  91. <para>
  92. Once you have done those two things, you should be able to issue a
  93. command and get back the proper response like this:
  94. </para>
  95. <para>
  96. <inlinegraphic scale="100" align="center" valign="middle"
  97. fileref="figures/zend.tool.framework.cliversionunix.png" format="PNG" />
  98. </para>
  99. <para>
  100. If you do not see this type of output, go back and check your setup
  101. to ensure you have all of the necessary peices in the proper place.
  102. </para>
  103. <para>
  104. There are a couple of alternative setups you might want to employ
  105. depending on your servers configuration, your level of access, or
  106. for other reasons.
  107. </para>
  108. <para>
  109. <emphasis>ALTERNATIVE SETUP</emphasis> involves keeping the Zend
  110. Framework download together as is, and creating a link from a PATH
  111. location to the <code>zf.sh</code>. What this means is you can
  112. place the contents of the ZendFramework download into a location
  113. such as <code>/usr/local/share/ZendFramework</code>, or more locally
  114. like <code>/home/username/lib/ZendFramework</code>, and creating a
  115. symbolic link to the <code>zf.sh</code>.
  116. </para>
  117. <para>
  118. Assuming you want to put the link inside <code>/usr/local/bin</code>
  119. (this could also work for placing the link inside
  120. <code>/home/username/bin/</code> for example) you would issue a
  121. command similar to this: </para>
  122. <programlisting language="sh"><![CDATA[
  123. ln -s /usr/local/share/ZendFramework/bin/zf.sh /usr/local/bin/zf
  124. # OR (for example)
  125. ln -s /home/username/lib/ZendFramework/bin/zf.sh /home/username/bin/zf
  126. ]]></programlisting>
  127. <para>
  128. This will create a link which you should be able to access globally
  129. on the command line.
  130. </para>
  131. </sect2>
  132. <sect2 id="zend.tool.framework.clitool.setup-windows">
  133. <title>Setting up the CLI tool on Windows</title>
  134. <para>
  135. The most common setup in the Windows Win32 environment, is to copy
  136. the <code>zf.sh</code> and <code>zf.php</code> into the same
  137. directory as your PHP binary. This can generally be found in one of
  138. the following places:
  139. </para>
  140. <programlisting language="text"><![CDATA[
  141. C:\PHP
  142. C:\Program Files\ZendServer\bin\
  143. C:\WAMP\PHP\bin
  144. ]]></programlisting>
  145. <para>
  146. You should be able to run <code>php.exe</code> on the command line.
  147. If you are not able to, first check the documentation that came with
  148. your PHP distribution, or ensure that the path to php.exe is in your
  149. windows PATH environment variable.
  150. </para>
  151. <para>
  152. The next order of business is to ensure that the Zend Framework
  153. library is setup correctly inside of the system PHP
  154. <code>include_path</code>. To find out where your
  155. <code>include_path</code> is located, you can type 'php -i' and look
  156. for the <code>include_path</code> variable, or more succinctly
  157. execute 'php -i | grep include_path' if you have Cygwin setup with
  158. grep available. Once you have found where your
  159. <code>include_path</code> is located (this will generally be
  160. something like <code>C:\PHP\pear</code>, <code>C:\PHP\share</code>,
  161. <code>C:\Program Files\ZendServer\share</code> or similar), ensure
  162. that the contents of the library/ directory are put inside your
  163. <code>include_path</code> specified directory.
  164. </para>
  165. <para>
  166. Once you have done those two things, you should be able to issue a
  167. command and get back the proper response like this:
  168. </para>
  169. <para>
  170. <inlinegraphic scale="100" align="center" valign="middle"
  171. fileref="figures/zend.tool.framework.cliversionwin32.png" format="PNG" />
  172. </para>
  173. <para>
  174. If you do not see this type of output, go back and check your setup
  175. to ensure you have all of the necessary pieces in the proper place.
  176. </para>
  177. <para>
  178. There are a couple of alternative setups you might want to employ
  179. depending on your server's configuration, your level of access, or
  180. for other reasons.
  181. </para>
  182. <para>
  183. <emphasis>ALTERNATIVE SETUP</emphasis> involves keeping the Zend
  184. Framework download together as is, and altering both your system
  185. PATH as well as the <code>php.ini</code> file. In your user's
  186. environment, make sure to add
  187. <code>C:\Path\To\ZendFramework\bin</code>, so that your
  188. <code>zf.bat</code> file is executable. Also, alter the
  189. <code>php.ini</code> file to ensure that
  190. <code>C:\Path\To\ZendFramework\library</code> is in your
  191. <code>include_path</code>.
  192. </para>
  193. </sect2>
  194. <sect2 id="zend.tool.framework.clitool.setup-othernotes">
  195. <title>Other Setup Considerations</title>
  196. <para>
  197. If for some reason you do not want the Zend Framework library inside
  198. your <code>include_path</code>, there is another option. There are
  199. two special environment variables that <code>zf.php</code> will
  200. utilize to determine the location of your Zend Framework
  201. installation.
  202. </para>
  203. <para>
  204. The first is <code>ZEND_TOOL_INCLUDE_PATH_PREPEND</code>, which will
  205. prepend the value of this environment variable to the system
  206. (<code>php.ini</code>) <code>include_path</code> before loading the
  207. client.
  208. </para>
  209. <para>
  210. Alternatively, you might want to use
  211. <code>ZEND_TOOL_INCLUDE_PATH</code> to completely
  212. <emphasis>replace</emphasis> the system <code>include_path</code>
  213. for one that makes sense specifically for the <code>zf</code>
  214. command line tool.
  215. </para>
  216. </sect2>
  217. <sect2 id="zend.tool.framework.clitool.continuing">
  218. <title>Where To Go Next?</title>
  219. <para>
  220. At this point, your should be setup to start initiating some more
  221. "interesting" commands. To get going, you can issue the <code>zf
  222. --help</code> command to see what is available to you.
  223. </para>
  224. <para>
  225. <inlinegraphic scale="100" align="center" valign="middle"
  226. fileref="figures/zend.tool.framework.clihelp.png" format="PNG" />
  227. </para>
  228. <para>
  229. Continue on to the <code>Zend_Tool_Project</code> "Create Project"
  230. section to understand how to use the <code>zf</code> script for
  231. project creation.
  232. </para>
  233. </sect2>
  234. </sect1>