Zend_Tool_Framework-Extending.xml 8.6 KB

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