Zend_Tool_Framework-Extending.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.tool.framework.extending">
  4. <title>Extending and Configuring Zend_Tool_Framework</title>
  5. <sect2 id="zend.tool.framework.console-client">
  6. <title>Customizing Zend_Tool Console Client</title>
  7. <para>
  8. As of Zend Framework 1.9, <classname>Zend_Tool_Framework</classname> allows developers
  9. to store information, provider specific configuration values, and custom files in a
  10. special location on the developers machine. These configuration values and files can be
  11. used by providers to extend functionality, customize functionality, or any other reasons
  12. a provider sees fit.
  13. </para>
  14. <para>
  15. The primary purpose, and the purpose most immediately used by existing providers is to
  16. allow developers to customize the way the "out of the box" providers do work.
  17. </para>
  18. <para>
  19. One of the more commonly requested features is to be able to provide custom project
  20. profiles to <classname>Zend_Tool_Project</classname>'s Project Provider. This would
  21. allow developers to store a custom profile in a special place that can be used
  22. repeatedly by the <classname>Zend_Tool</classname> system in order to build custom
  23. profiles. Another commonly requested feature is to be able to configure the behavior of
  24. providers with a configuration setting. In order to achieve this, not only do we have to
  25. have a <classname>Zend_Tool</classname> configuration file, but we also have to have a
  26. place to find this configuration file.
  27. </para>
  28. <sect3 id="zend.tool.framework.console-client.home-directory">
  29. <title>The Home Directory</title>
  30. <para>
  31. Before the Console Client can start searching for a <classname>Zend_Tool</classname>
  32. configuration file or a local storage directory, it must first be able to identify
  33. where the "home directory" is located.
  34. </para>
  35. <para>
  36. On *nix-based machines, <acronym>PHP</acronym> will be populated with an environment
  37. variable named <constant>HOME</constant> with a path to the current users home
  38. directory. Typically, this path will be very similar to
  39. <filename>/home/myusername</filename>.
  40. </para>
  41. <para>
  42. On Windows-based machines, <acronym>PHP</acronym> will typically be populated with
  43. an environment variable named <constant>HOMEPATH</constant> with the current users
  44. home directory. This directory is usually found in either
  45. <filename>C:\Documents and Settings\Username\</filename>, or in Vista at
  46. <filename>C:\Users\Username</filename>.
  47. </para>
  48. <para>
  49. If either a home directory cannot be found, or you wish to change the location of
  50. where <classname>Zend_Tool_Framework</classname> Console Client finds the home
  51. directory, you can provide an environment variable named
  52. <constant>ZF_HOME</constant> to specify where to find the home directory.
  53. </para>
  54. </sect3>
  55. <sect3 id="zend.tool.framework.console-client.local-storage">
  56. <title>Local Storage</title>
  57. <para>
  58. Once a home directory can be located, <classname>Zend_Tool_Framework</classname>'s
  59. Console Client can either autodiscover the local storage directory, or it can be
  60. told where to expect the local storage directory.
  61. </para>
  62. <para>
  63. Assuming the home directory has been found (here noted as <varname>$HOME</varname>),
  64. the Console Client will then look for the local storage directory in
  65. <filename>$HOME/.zf/</filename>. If found, it will set the local storage directory
  66. to this location.
  67. </para>
  68. <para>
  69. If the directory cannot be found, or the developer wishes to override this location,
  70. that can be done by setting an environment variable. Regardless if
  71. <varname>$HOME</varname> has been previously set or not, the developer may supply
  72. the environment variable <constant>ZF_STORAGE_DIR</constant>.
  73. </para>
  74. <para>
  75. Once the path to a local storage directory is found, the directory
  76. <emphasis>must</emphasis> exist for it to be passed into the
  77. <classname>Zend_Tool_Framework</classname> runtime, as it will not be created for
  78. you.
  79. </para>
  80. </sect3>
  81. <sect3 id="zend.tool.framework.console-client.configuration-file">
  82. <title>User Configuration</title>
  83. <para>
  84. Like local storage, once a home directory can be located,
  85. <classname>Zend_Tool_Framework</classname>'s Console Client can then either attempt
  86. to autodiscover the path to a configuration file, or it can be told specifically
  87. where to find the configuration file.
  88. </para>
  89. <para>
  90. Assuming the home directory has been found (here noted as <varname>$HOME</varname>),
  91. the Console Client will then attempt to look for the existence of a configuration
  92. file located at <filename>$HOME/.zf.ini</filename>. This file, if found, will be
  93. used as the configuration file for <classname>Zend_Tool_Framework</classname>.
  94. </para>
  95. <para>
  96. If that location does not exist, but a local storage directory does, then the
  97. Console Client will then attempt to locate the configuration file within the local
  98. storage directory. Assuming the local storage directory exists in
  99. <varname>$LOCAL_STORAGE</varname>, then if a file exists as
  100. <filename>$LOCAL_STORAGE/zf.ini</filename>, it will be found by the Console Client
  101. and utilized as the <classname>Zend_Tool_Framework</classname> configuration file.
  102. </para>
  103. <para>
  104. If the file cannot be autodiscovered or the developer wishes to specify the location
  105. of location of the configuration file, the developer can do so by setting an
  106. environment variable. If the environment variable
  107. <constant>ZF_CONFIG_FILE</constant> is set, then its value will be used as the
  108. location of the configuration file to use with the Console Client. The
  109. <constant>ZF_CONFIG_FILE</constant> can point to any
  110. <classname>Zend_Config</classname> readable <acronym>INI</acronym>,
  111. <acronym>XML</acronym> or <acronym>PHP</acronym> File.
  112. </para>
  113. <para>
  114. If the file does not exist in either the autodiscovered or the provided location, it
  115. will not be used as <classname>Zend_Tool_Framework</classname> does not attempt to
  116. create the file automatically.
  117. </para>
  118. </sect3>
  119. <sect3 id="zend.tool.framework.console-client.configuration-content">
  120. <title>User Configuration File Content</title>
  121. <para>
  122. The configuration file should be structured as a <classname>Zend_Config</classname>
  123. configuration file, in <acronym>INI</acronym> format, and without any sections being
  124. defined. First level keys should be used by the provider searching for a specific
  125. value. For example, if the "Project" provider is expecting a "profiles" directory,
  126. then it should typically be understood that it will search for the following
  127. <acronym>INI</acronym> key value pair:
  128. </para>
  129. <programlisting language="php"><![CDATA[
  130. project.profile = some/path/to/some-directory
  131. ]]></programlisting>
  132. <para>
  133. The only reserved <acronym>INI</acronym> prefix is the value "php". The "php" prefix
  134. to values will be reserved to store names and values of runtime settable
  135. <acronym>PHP</acronym> values, such as <property>include_path</property> or
  136. <property>error_reporting</property>. To override the
  137. <property>include_path</property> and <property>error_reporting</property> with an
  138. <acronym>INI</acronym> value, a developer would set:
  139. </para>
  140. <programlisting language="php"><![CDATA[
  141. php.include_path = "/path/to/includes1:/path/to/includes2"
  142. php.error_reporting = 1
  143. ]]></programlisting>
  144. <important>
  145. <para>
  146. The reserved prefix "php" only works with <acronym>INI</acronym> files. You
  147. can't set <acronym>PHP</acronym> <acronym>INI</acronym> values with
  148. <acronym>PHP</acronym> or <acronym>XML</acronym> config.
  149. </para>
  150. </important>
  151. </sect3>
  152. </sect2>
  153. </sect1>