Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/zendframework/zf2

  • Loading branch information...
commit e494b385cea7c3374db1832a6f833e2544a1d8bb 2 parents 7927a0f + dafaeb3
@sgehrig sgehrig authored
Showing with 8,729 additions and 3,560 deletions.
  1. +9 −11 README.txt
  2. +16 −0 bin/autoload_example.php
  3. +12 −0 bin/autoload_examples.php
  4. +147 −0 bin/classmap_generator.php
  5. +41 −0 bin/createAutoloadTestClasses.php
  6. +5 −4 bin/zf.php
  7. +156 −0 bin/zfals.php
  8. 0  demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist
  9. 0  demos/Zend/Service/LiveDocx/configuration.php.dist
  10. 0  demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php
  11. +59 −4 documentation/manual/en/manual.xml.in
  12. +0 −824 documentation/manual/en/module_specs/Zend_Loader-Autoloader.xml
  13. +171 −0 documentation/manual/en/module_specs/Zend_Loader-AutoloaderFactory.xml
  14. +212 −0 documentation/manual/en/module_specs/Zend_Loader-Broker.xml
  15. +357 −0 documentation/manual/en/module_specs/Zend_Loader-ClassMapAutoloader.xml
  16. +93 −0 documentation/manual/en/module_specs/Zend_Loader-Classmap_Generator.xml
  17. +506 −0 documentation/manual/en/module_specs/Zend_Loader-PluginBroker.xml
  18. +552 −0 documentation/manual/en/module_specs/Zend_Loader-PluginClassLoader.xml
  19. +131 −0 documentation/manual/en/module_specs/Zend_Loader-PluginClassLocater.xml
  20. +0 −270 documentation/manual/en/module_specs/Zend_Loader-PluginLoader.xml
  21. +240 −0 documentation/manual/en/module_specs/Zend_Loader-PluginSpecBroker.xml
  22. +693 −0 documentation/manual/en/module_specs/Zend_Loader-PrefixPathLoader.xml
  23. +112 −0 documentation/manual/en/module_specs/Zend_Loader-PrefixPathMapper.xml
  24. +155 −0 documentation/manual/en/module_specs/Zend_Loader-ShortNameLocater.xml
  25. +214 −0 documentation/manual/en/module_specs/Zend_Loader-SplAutoloader.xml
  26. +526 −0 documentation/manual/en/module_specs/Zend_Loader-StandardAutoloader.xml
  27. +0 −211 documentation/manual/en/module_specs/Zend_Loader.xml
  28. +39 −0 documentation/manual/en/module_specs/Zend_Mail-UsingFileTransport.xml
  29. +1 −1  documentation/manual/en/module_specs/Zend_Validate-Ip.xml
  30. +22 −21 library/Zend/Acl/Acl.php
  31. +1 −1  library/Zend/Acl/Exception.php
  32. +10 −0 library/Zend/Acl/Exception/InvalidArgumentException.php
  33. +10 −0 library/Zend/Acl/Exception/RuntimeException.php
  34. +10 −9 library/Zend/Acl/Role/Registry.php
  35. +1 −1  library/Zend/Amf/Adobe/Authentication.php
  36. +1 −1  library/Zend/Amf/Exception.php
  37. +9 −0 library/Zend/Amf/Exception/BadMethodCallException.php
  38. +9 −0 library/Zend/Amf/Exception/InvalidArgumentException.php
  39. +9 −0 library/Zend/Amf/Exception/LengthException.php
  40. +9 −0 library/Zend/Amf/Exception/RuntimeException.php
  41. +9 −0 library/Zend/Amf/Exception/UnderflowException.php
  42. +4 −3 library/Zend/Amf/Parser/Amf0/Deserializer.php
  43. +9 −8 library/Zend/Amf/Parser/Amf3/Deserializer.php
  44. +8 −8 library/Zend/Amf/Parser/Amf3/Serializer.php
  45. +7 −0 library/Zend/Amf/Parser/Exception.php
  46. +9 −0 library/Zend/Amf/Parser/Exception/InvalidArgumentException.php
  47. +9 −0 library/Zend/Amf/Parser/Exception/OutOfBoundsException.php
  48. +9 −0 library/Zend/Amf/Parser/Exception/RuntimeException.php
  49. +60 −0 library/Zend/Amf/Parser/ParserBroker.php
  50. +47 −0 library/Zend/Amf/Parser/ParserLoader.php
  51. +16 −39 library/Zend/Amf/Parser/TypeLoader.php
  52. +3 −3 library/Zend/Amf/Request/StreamRequest.php
  53. +69 −61 library/Zend/Amf/Server.php
  54. +4 −4 library/Zend/Amf/Util/BinaryStream.php
  55. +67 −255 library/Zend/Application/AbstractBootstrap.php
  56. +28 −12 library/Zend/Application/Application.php
  57. +17 −13 library/Zend/Application/Bootstrap.php
  58. +52 −0 library/Zend/Application/BootstrapAware.php
  59. +1 −1  library/Zend/Application/Exception.php
  60. +22 −0 library/Zend/Application/Exception/BadMethodCallException.php
  61. +5 −2 library/Zend/Application/{BootstrapException.php → Exception/InvalidArgumentException.php}
  62. +22 −0 library/Zend/Application/Exception/RuntimeException.php
  63. +1 −1  library/Zend/Application/Module/Autoloader.php
  64. +1 −16 library/Zend/Application/Resource.php
  65. +1 −1  library/Zend/Application/Resource/{Cachemanager.php → CacheManager.php}
  66. +7 −0 library/Zend/Application/Resource/Exception.php
  67. +5 −2 library/Zend/Application/{ResourceException.php → Resource/Exception/InitializationException.php}
  68. +12 −0 library/Zend/Application/Resource/Exception/InvalidArgumentException.php
  69. +12 −0 library/Zend/Application/Resource/Exception/RuntimeException.php
  70. +17 −8 library/Zend/Application/Resource/{Frontcontroller.php → FrontController.php}
  71. +2 −2 library/Zend/Application/Resource/Mail.php
  72. +2 −4 library/Zend/Application/Resource/Modules.php
  73. +2 −2 library/Zend/Application/Resource/{Multidb.php → MultiDb.php}
  74. +2 −2 library/Zend/Application/Resource/Session.php
  75. +3 −4 library/Zend/Application/Resource/Translate.php
  76. +15 −9 library/Zend/Application/Resource/View.php
  77. +7 −54 library/Zend/Application/ResourceBootstrapper.php
  78. +99 −0 library/Zend/Application/ResourceBroker.php
  79. +55 −0 library/Zend/Application/ResourceLoader.php
  80. +6 −3 library/Zend/Authentication/Adapter/DbTable.php
  81. +3 −3 library/Zend/Authentication/Adapter/Digest.php
  82. +1 −1  library/Zend/Authentication/Adapter/Exception.php
  83. +9 −0 library/Zend/Authentication/Adapter/Exception/InvalidArgumentException.php
  84. +10 −0 library/Zend/Authentication/Adapter/Exception/RuntimeException.php
  85. +9 −0 library/Zend/Authentication/Adapter/Exception/UnexpectedValueException.php
  86. +20 −19 library/Zend/Authentication/Adapter/Http.php
  87. +1 −1  library/Zend/Authentication/Adapter/Http/Exception.php
  88. +6 −6 library/Zend/Authentication/Adapter/Http/FileResolver.php
  89. +3 −2 library/Zend/{Loader → Authentication/Adapter/Http}/InvalidArgumentException.php
  90. +9 −0 library/Zend/Authentication/Adapter/Http/RuntimeException.php
  91. +1 −1  library/Zend/Authentication/Adapter/Ldap.php
  92. +1 −1  library/Zend/Authentication/Exception.php
  93. +16 −22 library/Zend/Barcode/Barcode.php
  94. +1 −1  library/Zend/Barcode/{Renderer.php → BarcodeRenderer.php}
  95. +3 −31 library/Zend/Barcode/Exception.php
  96. +41 −0 library/Zend/Barcode/Exception/InvalidArgumentException.php
  97. +41 −0 library/Zend/Barcode/Exception/RendererCreationException.php
  98. +18 −14 library/Zend/Barcode/Object/AbstractObject.php
  99. +3 −2 library/Zend/Barcode/Object/Ean8.php
  100. +1 −1  library/Zend/Barcode/Object/Exception.php
  101. +41 −0 library/Zend/Barcode/Object/Exception/BarcodeValidationException.php
  102. +9 −0 library/Zend/Barcode/Object/Exception/ExtensionNotLoadedException.php
  103. +41 −0 library/Zend/Barcode/Object/Exception/InvalidArgumentException.php
  104. +41 −0 library/Zend/Barcode/Object/Exception/OutOfRangeException.php
  105. +41 −0 library/Zend/Barcode/Object/Exception/RuntimeException.php
  106. +3 −2 library/Zend/Barcode/Object/Upce.php
  107. +17 −20 library/Zend/Barcode/Renderer/AbstractRenderer.php
  108. +1 −2  library/Zend/Barcode/Renderer/Exception.php
  109. +41 −0 library/Zend/Barcode/Renderer/Exception/InvalidArgumentException.php
  110. +41 −0 library/Zend/Barcode/Renderer/Exception/OutOfRangeException.php
  111. +41 −0 library/Zend/Barcode/Renderer/Exception/RuntimeException.php
  112. +41 −0 library/Zend/Barcode/Renderer/Exception/UnexpectedValueException.php
  113. +22 −22 library/Zend/Barcode/Renderer/Image.php
  114. +4 −2 library/Zend/Barcode/Renderer/Pdf.php
  115. +9 −7 library/Zend/Barcode/Renderer/Svg.php
  116. +5 −26 library/Zend/Cache/Cache.php
  117. +2 −2 library/Zend/Captcha/Exception.php
  118. +41 −0 library/Zend/Captcha/Exception/ExtensionNotLoadedException.php
  119. +41 −0 library/Zend/Captcha/Exception/ImageNotLoadableException.php
  120. +41 −0 library/Zend/Captcha/Exception/NoFontProvidedException.php
  121. +46 −17 library/Zend/Captcha/Image.php
  122. +1 −1  library/Zend/Captcha/ReCaptcha.php
  123. +1 −1  library/Zend/CodeGenerator/Exception.php
  124. +1 −1  library/Zend/CodeGenerator/Php/Exception.php
  125. +8 −0 library/Zend/CodeGenerator/Php/Exception/InvalidArgumentException.php
  126. +8 −0 library/Zend/CodeGenerator/Php/Exception/RuntimeException.php
  127. +5 −5 library/Zend/CodeGenerator/Php/PhpClass.php
  128. +1 −1  library/Zend/CodeGenerator/Php/PhpDocblock.php
  129. +5 −5 library/Zend/CodeGenerator/Php/PhpFile.php
  130. +3 −2 library/Zend/CodeGenerator/Php/PhpMember/AbstractMember.php
  131. +1 −1  library/Zend/CodeGenerator/Php/PhpMethod.php
  132. +1 −1  library/Zend/CodeGenerator/Php/PhpProperty.php
  133. +1 −1  library/Zend/CodeGenerator/Php/PhpValue.php
  134. +3 −3 library/Zend/Config/Config.php
  135. +2 −1  library/Zend/Config/Exception.php
  136. +9 −0 library/Zend/Config/Exception/InvalidArgumentException.php
  137. +9 −0 library/Zend/Config/Exception/RuntimeException.php
  138. +7 −7 library/Zend/Config/Ini.php
  139. +3 −3 library/Zend/Config/Writer/AbstractFileWriter.php
  140. +1 −1  library/Zend/Config/Writer/Ini.php
  141. +1 −1  library/Zend/Config/Writer/Xml.php
  142. +9 −9 library/Zend/Config/Xml.php
  143. +10 −0 library/Zend/Console/Exception/InvalidArgumentException.php
  144. +4 −2 library/Zend/Console/{GetoptException.php → Exception/RuntimeException.php}
  145. +16 −18 library/Zend/Console/Getopt.php
  146. +52 −38 library/Zend/Controller/Action.php
  147. +3 −4 library/Zend/Controller/Action/Helper/AbstractAutoComplete.php
  148. +36 −5 library/Zend/Controller/Action/Helper/AbstractHelper.php
  149. +2 −8 library/Zend/Controller/Action/Helper/AutoCompleteDojo.php
  150. +28 −12 library/Zend/Controller/Action/Helper/ContextSwitch.php
  151. +1 −4 library/Zend/Controller/Action/Helper/Json.php
  152. +15 −44 library/Zend/Controller/Action/Helper/ViewRenderer.php
  153. +85 −262 library/Zend/Controller/Action/HelperBroker.php
  154. +58 −0 library/Zend/Controller/Action/HelperLoader.php
  155. +1 −3 library/Zend/Controller/Action/HelperPriorityStack.php
  156. +10 −0 library/Zend/Controller/Dispatcher.php
  157. +20 −1 library/Zend/Controller/Dispatcher/AbstractDispatcher.php
  158. +11 −1 library/Zend/Controller/Dispatcher/Standard.php
  159. +56 −16 library/Zend/Controller/Front.php
  160. +32 −1 library/Zend/Controller/Plugin/AbstractPlugin.php
  161. +12 −0 library/Zend/Controller/Plugin/Broker.php
  162. +3 −3 library/Zend/Crypt/Math.php
  163. +14 −14 library/Zend/Currency/Currency.php
  164. +1 −1  library/Zend/Currency/Exception.php
  165. +10 −0 library/Zend/Currency/Exception/InvalidArgumentException.php
  166. +10 −0 library/Zend/Currency/Exception/RuntimeException.php
  167. +1 −1  library/Zend/Date/Cities.php
  168. +102 −102 library/Zend/Date/Date.php
  169. +2 −2 library/Zend/Date/DateObject.php
  170. +1 −13 library/Zend/Date/Exception.php
  171. +27 −0 library/Zend/Date/Exception/InvalidArgumentException.php
  172. +10 −0 library/Zend/Date/Exception/RuntimeException.php
  173. 0  library/Zend/Db/Adapter/Pdo/Mssql.php
  174. 0  library/Zend/Db/Adapter/Pdo/Oci.php
  175. 0  library/Zend/Db/Adapter/Pdo/Pgsql.php
  176. 0  library/Zend/Db/Adapter/Pdo/Sqlite.php
  177. +3 −3 library/Zend/Dojo/BuildLayer.php
  178. +11 −11 library/Zend/Dojo/Data.php
  179. +1 −1  library/Zend/Dojo/Exception.php
  180. +8 −0 library/Zend/Dojo/Exception/InvalidArgumentException.php
  181. +8 −0 library/Zend/Dojo/Exception/RuntimeException.php
  182. +1 −1  library/Zend/Dojo/View/Exception.php
  183. +8 −0 library/Zend/Dojo/View/Exception/BadMethodCallException.php
  184. +8 −0 library/Zend/Dojo/View/Exception/InvalidArgumentException.php
  185. +8 −0 library/Zend/Dojo/View/Exception/RuntimeException.php
  186. +3 −3 library/Zend/Dojo/View/Helper/CustomDijit.php
  187. +3 −3 library/Zend/Dojo/View/Helper/DijitContainer.php
  188. +2 −2 library/Zend/Dojo/View/Helper/Dojo.php
  189. +7 −7 library/Zend/Dojo/View/Helper/Dojo/Container.php
  190. +3 −3 library/Zend/Dojo/View/Helper/Slider.php
  191. +2 −2 library/Zend/Dom/Exception.php
  192. +7 −7 library/Zend/{Tool/Framework/Action/Exception.php → Dom/Exception/RuntimeException.php}
  193. +3 −3 library/Zend/Dom/Query.php
  194. +155 −0 library/Zend/File/ClassFileLocater.php
  195. +34 −0 library/Zend/File/Exception.php
  196. +37 −0 library/Zend/File/Exception/InvalidArgumentException.php
  197. +61 −79 library/Zend/File/Transfer/Adapter/AbstractAdapter.php
  198. +9 −8 library/Zend/File/Transfer/Adapter/Http.php
  199. +19 −19 library/Zend/File/Transfer/Exception.php
  200. +8 −0 library/Zend/File/Transfer/Exception/BadMethodCallException.php
  201. +8 −0 library/Zend/File/Transfer/Exception/InvalidArgumentException.php
  202. +8 −0 library/Zend/File/Transfer/Exception/PhpEnvironmentException.php
  203. +8 −0 library/Zend/File/Transfer/Exception/RuntimeException.php
  204. +7 −7 library/Zend/File/{ → Transfer}/Transfer.php
  205. +1 −1  library/Zend/Filter/AbstractFilter.php
  206. +3 −3 library/Zend/Filter/Boolean.php
  207. +2 −2 library/Zend/Filter/Callback.php
  208. +3 −3 library/Zend/Filter/Compress.php
  209. +6 −6 library/Zend/Filter/Compress/Bz2.php
  210. +7 −7 library/Zend/Filter/Compress/Gz.php
  211. +3 −3 library/Zend/Filter/Compress/Lzf.php
  212. +8 −8 library/Zend/Filter/Compress/Rar.php
  213. +9 −9 library/Zend/Filter/Compress/Tar.php
  214. +11 −11 library/Zend/Filter/Compress/Zip.php
  215. +2 −2 library/Zend/Filter/Encrypt.php
  216. +10 −10 library/Zend/Filter/Encrypt/Mcrypt.php
  217. +10 −10 library/Zend/Filter/Encrypt/Openssl.php
  218. +1 −1  library/Zend/Filter/Exception.php
  219. +9 −0 library/Zend/Filter/Exception/BadMethodCallException.php
  220. +10 −0 library/Zend/Filter/Exception/ExtensionNotLoadedException.php
  221. +9 −0 library/Zend/Filter/Exception/InvalidArgumentException.php
  222. +9 −0 library/Zend/Filter/Exception/RuntimeException.php
  223. +6 −5 library/Zend/Filter/File/Decrypt.php
  224. +7 −6 library/Zend/Filter/File/Encrypt.php
  225. +6 −5 library/Zend/Filter/File/LowerCase.php
  226. +6 −5 library/Zend/Filter/File/Rename.php
  227. +6 −5 library/Zend/Filter/File/UpperCase.php
  228. +1 −1  library/Zend/Filter/Filter.php
  229. +54 −0 library/Zend/Filter/FilterBroker.php
  230. +153 −0 library/Zend/Filter/FilterLoader.php
  231. +1 −1  library/Zend/Filter/HtmlEntities.php
  232. +21 −47 library/Zend/Filter/Inflector.php
  233. +141 −235 library/Zend/Filter/InputFilter.php
  234. +1 −1  library/Zend/Filter/Null.php
  235. +1 −1  library/Zend/Filter/PregReplace.php
  236. +20 −54 library/Zend/Filter/StaticFilter.php
  237. +2 −2 library/Zend/Filter/StringToLower.php
  238. +2 −2 library/Zend/Filter/StringToUpper.php
  239. +1 −1  library/Zend/Filter/Word/AbstractSeparator.php
  240. +1 −1  library/Zend/Filter/Word/SeparatorToSeparator.php
  241. +2 −2 library/Zend/Form/Decorator/AbstractDecorator.php
  242. +3 −3 library/Zend/Form/Decorator/Callback.php
  243. +1 −1  library/Zend/Form/Decorator/Errors.php
  244. +1 −1  library/Zend/Form/Decorator/Exception.php
  245. +40 −0 library/Zend/Form/Decorator/Exception/BadMethodCallException.php
  246. +40 −0 library/Zend/Form/Decorator/Exception/InvalidArgumentException.php
  247. +40 −0 library/Zend/Form/Decorator/Exception/RunTimeException.php
  248. +40 −0 library/Zend/Form/Decorator/Exception/UnexpectedValueException.php
  249. +1 −1  library/Zend/Form/Decorator/Fieldset.php
  250. +1 −1  library/Zend/Form/Decorator/FormDecorator.php
  251. +6 −6 library/Zend/Form/Decorator/Label.php
  252. +3 −3 library/Zend/Form/Decorator/ViewHelper.php
  253. +2 −2 library/Zend/Form/Decorator/ViewScript.php
  254. +14 −18 library/Zend/Form/DisplayGroup.php
  255. +36 −37 library/Zend/Form/Element.php
  256. +4 −6 library/Zend/Form/{ElementException.php → Element/Exception.php}
  257. +40 −0 library/Zend/Form/Element/Exception/BadMethodCallException.php
  258. +40 −0 library/Zend/Form/Element/Exception/InvalidArgumentException.php
  259. +40 −0 library/Zend/Form/Element/Exception/RunTimeException.php
  260. +40 −0 library/Zend/Form/Element/Exception/UnexpectedValueException.php
  261. +7 −11 library/Zend/Form/Element/File.php
  262. +3 −6 library/Zend/Form/Exception.php
  263. +8 −7 library/Zend/{Authentication/Storage/Exception.php → Form/Exception/BadMethodCallException.php}
  264. +38 −0 library/Zend/Form/Exception/InvalidArgumentException.php
  265. +38 −0 library/Zend/Form/Exception/UnexpectedValueException.php
  266. +45 −43 library/Zend/Form/Form.php
  267. +2 −2 library/Zend/Form/SubForm.php
  268. +19 −19 library/Zend/Http/Client.php
  269. +13 −12 library/Zend/Http/Client/Adapter/Curl.php
  270. +2 −4 library/Zend/Http/Client/Adapter/Exception.php
  271. +38 −0 library/Zend/Http/Client/Adapter/Exception/InitializationException.php
  272. +38 −0 library/Zend/Http/Client/Adapter/Exception/InvalidArgumentException.php
  273. +38 −0 library/Zend/Http/Client/Adapter/Exception/OutOfRangeException.php
  274. +38 −0 library/Zend/Http/Client/Adapter/Exception/RuntimeException.php
  275. +40 −0 library/Zend/Http/Client/Adapter/Exception/TimeoutException.php
  276. +9 −8 library/Zend/Http/Client/Adapter/Proxy.php
  277. +17 −16 library/Zend/Http/Client/Adapter/Socket.php
  278. +7 −6 library/Zend/Http/Client/Adapter/Test.php
  279. +1 −1  library/Zend/Http/Client/Exception.php
  280. +38 −0 library/Zend/Http/Client/Exception/InvalidArgumentException.php
  281. +38 −0 library/Zend/Http/Client/Exception/RuntimeException.php
  282. +8 −8 library/Zend/Http/Cookie.php
  283. +7 −7 library/Zend/Http/CookieJar.php
  284. +1 −2  library/Zend/Http/Exception.php
  285. +38 −0 library/Zend/Http/Exception/InvalidArgumentException.php
  286. +8 −9 library/Zend/{Tag/Cloud/Exception.php → Http/Exception/RuntimeException.php}
  287. +6 −6 library/Zend/Http/Response.php
  288. +1 −1  library/Zend/InfoCard/Cipher.php
  289. +1 −1  library/Zend/InfoCard/Cipher/Exception.php
  290. +8 −0 library/Zend/InfoCard/Cipher/Exception/ExtensionNotLoadedException.php
  291. +8 −0 library/Zend/InfoCard/Cipher/Exception/InvalidArgumentException.php
  292. +8 −0 library/Zend/InfoCard/Cipher/Exception/RuntimeException.php
  293. +1 −1  library/Zend/InfoCard/Cipher/PKI/Adapter/AbstractAdapter.php
  294. +3 −3 library/Zend/InfoCard/Cipher/PKI/Adapter/RSA.php
  295. +2 −2 library/Zend/InfoCard/Cipher/Symmetric/Adapter/AES256CBC.php
  296. +5 −5 library/Zend/InfoCard/Claims.php
  297. +3 −13 library/Zend/InfoCard/Exception.php
  298. +8 −0 library/Zend/InfoCard/Exception/ExtensionNotLoadedException.php
  299. +8 −0 library/Zend/InfoCard/Exception/InvalidArgumentException.php
  300. +8 −0 library/Zend/InfoCard/Exception/RuntimeException.php
Sorry, we could not display the entire diff because too many files (1,701) changed.
View
20 README.txt
@@ -2,25 +2,23 @@ Welcome to the Zend Framework 2.0.0 Release!
RELEASE INFORMATION
---------------
-Zend Framework 2.0.0dev1
+Zend Framework 2.0.0dev2
THIS RELEASE IS A DEVELOPMENT RELEASE AND NOT INTENDED FOR PRODUCTION USE.
PLEASE USE AT YOUR OWN RISK.
-At this time, we have tested all functionality of Zend\Tool, and followed the
-Quick Start application instructions, and all functionality works as it did in
-the ZF1 series of releases. However, most Zend\Service components have not been
-migrated to namespaces, and Zend\Db has not been completely vetted (in favor of
-doing a complete refactor). Again, please use at your own risk, and be prepared
-for major changes in APIs in the development and alpha milestones prior to the
-first beta release.
-
NEW FEATURES
------------
-Please see the ZF2 Requirements page for details on new features and changes:
+This release concludes two different milestones:
+
+ - Autoloading and Plugin Loading:
+ http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Milestones#ZendFramework2.0Milestones-Milestone%3AAutoloading%26PluginLoading
+ - Exceptions
+ http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Milestones#ZendFramework2.0Milestones-Milestone%3AExceptions
- http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Requirements
+Several components are still in progress, or were skipped due to planned
+rewrites later.
SYSTEM REQUIREMENTS
-------------------
View
16 bin/autoload_example.php
@@ -0,0 +1,16 @@
+<?php
+require_once __DIR__ . '/../library/Zend/Loader/ClassMapAutoloader.php';
+$loader = new Zend\Loader\ClassMapAutoloader();
+$loader->registerAutoloadMap(__DIR__ . '/../library/Zend/Controller/.classmap.php');
+$loader->register();
+
+if (!class_exists('Zend\Controller\Action')) {
+ echo "Could not find action class?\n";
+} else {
+ echo "Found action class!\n";
+}
+if (!class_exists('Zend\Version')) {
+ echo "Could not find version class!\n";
+} else {
+ echo "Found version class?\n";
+}
View
12 bin/autoload_examples.php
@@ -0,0 +1,12 @@
+<?php
+require_once __DIR__ . '/../library/Zend/.classmap.php';
+if (!class_exists('Zend\Controller\Action')) {
+ echo "Could not find action class?\n";
+} else {
+ echo "Found action class!\n";
+}
+if (!class_exists('Zend\Version')) {
+ echo "Could not find version class?\n";
+} else {
+ echo "Found version class!\n";
+}
View
147 bin/classmap_generator.php
@@ -0,0 +1,147 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Loader
+ * @subpackage Exception
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+/**
+ * Generate class maps for use with autoloading.
+ *
+ * Usage:
+ * --help|-h Get usage message
+ * --library|-l [ <string> ] Library to parse; if none provided, assumes
+ * current directory
+ * --output|-o [ <string> ] Where to write autoload file; if not provided,
+ * assumes ".classmap.php" in library directory
+ * --overwrite|-w Whether or not to overwrite existing autoload
+ * file
+ */
+
+$libPath = __DIR__ . '/../library';
+if (!is_dir($libPath)) {
+ // Try to load StandardAutoloader from include_path
+ if (false === include('Zend/Loader/StandardAutoloader.php')) {
+ echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
+ exit(2);
+ }
+} else {
+ // Try to load StandardAutoloader from library
+ if (false === include(__DIR__ . '/../library/Zend/Loader/StandardAutoloader.php')) {
+ echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
+ exit(2);
+ }
+}
+
+// Setup autoloading
+$loader = new Zend\Loader\StandardAutoloader();
+$loader->register();
+
+$rules = array(
+ 'help|h' => 'Get usage message',
+ 'library|l-s' => 'Library to parse; if none provided, assumes current directory',
+ 'output|o-s' => 'Where to write autoload file; if not provided, assumes ".classmap.php" in library directory',
+ 'overwrite|w' => 'Whether or not to overwrite existing autoload file',
+);
+
+try {
+ $opts = new Zend\Console\Getopt($rules);
+ $opts->parse();
+} catch (Zend\Console\Getopt\Exception $e) {
+ echo $e->getUsageMessage();
+ exit(2);
+}
+
+if ($opts->getOption('h')) {
+ echo $opts->getUsageMessage();
+ exit();
+}
+
+$path = $libPath;
+if (array_key_exists('PWD', $_SERVER)) {
+ $path = $_SERVER['PWD'];
+}
+if (isset($opts->l)) {
+ $path = $opts->l;
+ if (!is_dir($path)) {
+ echo "Invalid library directory provided" . PHP_EOL . PHP_EOL;
+ echo $opts->getUsageMessage();
+ exit(2);
+ }
+ $path = realpath($path);
+}
+
+$usingStdout = false;
+$output = $path . DIRECTORY_SEPARATOR . '.classmap.php';
+if (isset($opts->o)) {
+ $output = $opts->o;
+ if ('-' == $output) {
+ $output = STDOUT;
+ $usingStdout = true;
+ } elseif (!is_writeable(dirname($output))) {
+ echo "Cannot write to '$output'; aborting." . PHP_EOL
+ . PHP_EOL
+ . $opts->getUsageMessage();
+ exit(2);
+ } elseif (file_exists($output)) {
+ if (!$opts->getOption('w')) {
+ echo "Autoload file already exists at '$output'," . PHP_EOL
+ . "but 'overwrite' flag was not specified; aborting." . PHP_EOL
+ . PHP_EOL
+ . $opts->getUsageMessage();
+ exit(2);
+ }
+ }
+}
+
+$strip = $path;
+
+if (!$usingStdout) {
+ echo "Creating class file map for library in '$path'..." . PHP_EOL;
+}
+
+// Get the ClassFileLocater, and pass it the library path
+$l = new \Zend\File\ClassFileLocater($path);
+
+// Iterate over each element in the path, and create a map of
+// classname => filename, where the filename is relative to the library path
+$map = new \stdClass;
+$strip .= DIRECTORY_SEPARATOR;
+iterator_apply($l, function() use ($l, $map, $strip){
+ $file = $l->current();
+ $namespace = empty($file->namespace) ? '' : $file->namespace . '\\';
+ $filename = str_replace($strip, '', $file->getRealpath());
+
+ $map->{$namespace . $file->classname} = $filename;
+
+ return true;
+});
+
+// Create a file with the class/file map.
+// Stupid syntax highlighters make separating < from PHP declaration necessary
+$content = '<' . "?php\n"
+ . 'return ' . var_export((array) $map, true) . ';';
+
+// Prefix with __DIR__; modify the generated content
+$content = preg_replace('#(=> )#', '$1__DIR__ . DIRECTORY_SEPARATOR . ', $content);
+
+// Write the contents to disk
+file_put_contents($output, $content);
+
+if (!$usingStdout) {
+ echo "Wrote classmap file to '" . realpath($output) . "'" . PHP_EOL;
+}
View
41 bin/createAutoloadTestClasses.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * createAutoloadTestClasses.php
+ *
+ * A script for creating a hierarchy of classes for use with testing
+ * autoloading. Each directory has classes from a to p; additional classes are
+ * generated 2 levels deep, giving a total of 16^3 classes to use in
+ * autoloading tests.
+ */
+
+function createClasses($depth, $namespace)
+{
+ foreach (range('a', 'p') as $letter) {
+ // Create content for namespaced class
+ $content =<<<EOT
+<?php
+namespace $namespace;
+class $letter { }
+EOT;
+
+ // Write content to disk
+ $dir = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
+ file_put_contents(
+ $dir . DIRECTORY_SEPARATOR . $letter . '.php',
+ $content
+ );
+
+ // If we still have depth, recurse and create more classes using the
+ // current letter as a sub-namespace.
+ if ($depth > 0) {
+ $childDir = $dir . DIRECTORY_SEPARATOR . $letter;
+ mkdir($childDir);
+ createClasses($depth - 1, $namespace . '\\' . $letter);
+ }
+ }
+}
+
+// Use 'test' as the top-level namespace, and set a depth of "2" (will provide
+// 3 levels of classes).
+mkdir('test');
+createClasses(2, 'test');
View
9 bin/zf.php 100755 → 100644
@@ -383,14 +383,14 @@ protected function _setupToolRuntime()
protected function _tryClientLoad()
{
$this->_clientLoaded = false;
- $fh = @fopen('Zend/Loader/Autoloader.php', 'r', true);
+ $fh = @fopen('Zend/Loader/StandardAutoloader.php', 'r', true);
if (!$fh) {
return $this->_clientLoaded; // false
} else {
fclose($fh);
unset($fh);
- include 'Zend/Loader/Autoloader.php';
- $this->_clientLoaded = class_exists('Zend\Loader\Autoloader', false);
+ include 'Zend/Loader/StandardAutoloader.php';
+ $this->_clientLoaded = class_exists('Zend\Loader\StandardAutoloader', false);
}
return $this->_clientLoaded;
@@ -604,7 +604,8 @@ protected function _runTool()
// ensure that zf.php loads the Zend_Tool_Project features
$configOptions['classesToLoad'] = 'Zend\Tool\Project\Provider\Manifest';
- Zend\Loader\Autoloader::getInstance();
+ $autoloader = new Zend\Loader\StandardAutoloader();
+ $autoloader->register();
$console = new Zend\Tool\Framework\Client\Console\Console($configOptions);
$console->dispatch();
View
156 bin/zfals.php
@@ -0,0 +1,156 @@
+<?php
+$libPath = __DIR__ . '/../library';
+if (!is_dir($libPath)) {
+ echo "Unable to find Zend Framework library; aborting" . PHP_EOL;
+ exit(2);
+}
+$libPath = realpath($libPath);
+
+// Add ZF to the include_path, if it isn't already
+$incPath = get_include_path();
+if (!strstr($incPath, $libPath)) {
+ set_include_path($libPath . PATH_SEPARATOR . $incPath);
+}
+
+// Setup autoloading
+$loader = new Zend\Loader\StandardAutoloader();
+require_once 'Zend/Loader/StandardAutoloader.php';
+$loader->register();
+
+$rules = array(
+ 'help|h' => 'Get usage message',
+ 'library|l-s' => 'Library to parse; if none provided, assumes current directory',
+ 'namespace|n-s' => 'Namespace in which to create map; by default, uses last segment of library directory name',
+ 'output|o-s' => 'Where to write autoload file; if not provided, assumes "_autoload.php" in library directory',
+ 'overwrite|w' => 'Whether or not to overwrite existing autoload file',
+ 'keepdepth|k-i' => 'How many additional segments of the library path to keep in the generated classfile map',
+ 'usedir|d' => 'Prepend filenames with __DIR__',
+);
+
+try {
+ $opts = new Zend\Console\Getopt($rules);
+ $opts->parse();
+} catch (Zend\Console\Getopt\Exception $e) {
+ echo $e->getUsageMessage();
+ exit(2);
+}
+
+if ($opts->getOption('h')) {
+ echo $opts->getUsageMessage();
+ exit();
+}
+
+$path = $libPath;
+if (array_key_exists('PWD', $_SERVER)) {
+ $path = $_SERVER['PWD'];
+}
+if (isset($opts->l)) {
+ $path = $opts->l;
+ if (!is_dir($path)) {
+ echo "Invalid library directory provided" . PHP_EOL . PHP_EOL;
+ echo $opts->getUsageMessage();
+ exit(2);
+ }
+ $path = realpath($path);
+}
+
+$namespace = substr($path, strrpos($path, DIRECTORY_SEPARATOR) + 1);
+if (isset($opts->n)) {
+ $tmp = $opts->n;
+ if (!empty($tmp)) {
+ if (!preg_match('#^[a-z][a-z0-9]*(\\\\[a-z][a-z[0-9_]])*#', $tmp)) {
+ echo "Invalid namespace provided; aborting." . PHP_EOL
+ . PHP_EOL
+ . $opts->getUsageMessage();
+ exit(2);
+ }
+ $namespace = $tmp;
+ }
+}
+
+$usingStdout = false;
+$output = $path . DIRECTORY_SEPARATOR . '_autoload.php';
+if (isset($opts->o)) {
+ $output = $opts->o;
+ if ('-' == $output) {
+ $output = STDOUT;
+ $usingStdout = true;
+ } elseif (!is_writeable(dirname($output))) {
+ echo "Cannot write to '$output'; aborting." . PHP_EOL
+ . PHP_EOL
+ . $opts->getUsageMessage();
+ exit(2);
+ } elseif (file_exists($output)) {
+ if (!$opts->getOption('w')) {
+ echo "Autoload file already exists at '$output'," . PHP_EOL
+ . "but 'overwrite' flag was not specified; aborting." . PHP_EOL
+ . PHP_EOL
+ . $opts->getUsageMessage();
+ exit(2);
+ }
+ }
+}
+
+$strip = $path;
+$keepDepth = 0;
+if (isset($opts->k)) {
+ $keepDepth = $opts->k;
+ if ($keepDepth < 0) {
+ $keepDepth = 0;
+ }
+}
+if ($keepDepth > 0) {
+ $segments = explode(DIRECTORY_SEPARATOR, $path);
+ do {
+ array_pop($segments);
+ --$keepDepth;
+ } while (count($segments) > 0 && $keepDepth > 0);
+ $strip = implode(DIRECTORY_SEPARATOR, $segments);
+}
+
+$prefixWithDir = $opts->getOption('d');
+
+if (!$usingStdout) {
+ echo "Creating class file map for library in '$path'..." . PHP_EOL;
+}
+
+// Get the ClassFileLocater, and pass it the library path
+$l = new \Zend\File\ClassFileLocater($path);
+
+// Iterate over each element in the path, and create a map of
+// classname => filename, where the filename is relative to the library path
+$map = new \stdClass;
+$strip .= DIRECTORY_SEPARATOR;
+iterator_apply($l, function() use ($l, $map, $strip){
+ $file = $l->current();
+ $namespace = empty($file->namespace) ? '' : $file->namespace . '\\';
+ $filename = str_replace($strip, '', $file->getRealpath());
+
+ $map->{$namespace . $file->classname} = $filename;
+
+ return true;
+});
+
+// Create a file with the class/file map.
+// Stupid syntax highlighters make separating < from PHP declaration necessary
+$map = var_export((array) $map, true);
+$content =<<<EOT
+<?php
+namespace $namespace;
+\$_map = $map;
+spl_autoload_register(function(\$class) use (\$_map) {
+ if (array_key_exists(\$class, \$_map)) {
+ require_once \$_map[\$class];
+ }
+});
+EOT;
+
+// If requested to prefix with __DIR__, modify the content
+if ($prefixWithDir) {
+ $content = preg_replace('#(=> )#', '$1__DIR__ . DIRECTORY_SEPARATOR . ', $content);
+}
+file_put_contents($output, $content);
+
+if (!$usingStdout) {
+ echo "Wrote autoload file to '" . realpath($output) . "'" . PHP_EOL;
+}
View
0  demos/Zend/Service/LiveDocx/DemoConfiguration.php.dist 100755 → 100644
File mode changed
View
0  demos/Zend/Service/LiveDocx/configuration.php.dist 100755 → 100644
File mode changed
View
0  demos/Zend/Service/LiveDocx/library/Zend/Service/LiveDocx/Helper.php 100755 → 100644
File mode changed
View
63 documentation/manual/en/manual.xml.in
@@ -1196,9 +1196,29 @@
<xi:include href="../en/module_specs/Zend_Loader.xml" />
</xi:fallback>
</xi:include>
- <xi:include href="module_specs/Zend_Loader-Autoloader.xml">
+ <xi:include href="module_specs/Zend_Loader-SplAutoloader.xml">
<xi:fallback>
- <xi:include href="../en/module_specs/Zend_Loader-Autoloader.xml" />
+ <xi:include href="../en/module_specs/Zend_Loader-SplAutoloader.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-AutoloaderFactory.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-AutoloaderFactory.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-StandardAutoloader.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-StandardAutoloader.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-ClassMapAutoloader.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-ClassMapAutoloader.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-Classmap_Generator.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-Classmap_Generator.xml" />
</xi:fallback>
</xi:include>
<xi:include href="module_specs/Zend_Loader-Autoloader-Resource.xml">
@@ -1206,9 +1226,39 @@
<xi:include href="../en/module_specs/Zend_Loader-Autoloader-Resource.xml" />
</xi:fallback>
</xi:include>
- <xi:include href="module_specs/Zend_Loader-PluginLoader.xml">
+ <xi:include href="module_specs/Zend_Loader-ShortNameLocater.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-ShortNameLocater.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-PluginClassLocater.xml">
<xi:fallback>
- <xi:include href="../en/module_specs/Zend_Loader-PluginLoader.xml" />
+ <xi:include href="../en/module_specs/Zend_Loader-PluginClassLocater.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-PluginClassLoader.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-PluginClassLoader.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-PrefixPathMapper.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-PrefixPathMapper.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-PrefixPathLoader.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-PrefixPathLoader.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-Broker.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-Broker.xml" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="module_specs/Zend_Loader-PluginBroker.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Loader-PluginBroker.xml" />
</xi:fallback>
</xi:include>
</chapter>
@@ -1293,6 +1343,11 @@
<xi:include href="../en/module_specs/Zend_Mail-DifferentTransports.xml" />
</xi:fallback>
</xi:include>
+ <xi:include href="module_specs/Zend_Mail-UsingFileTransport.xml">
+ <xi:fallback>
+ <xi:include href="../en/module_specs/Zend_Mail-UsingFileTransport.xml" />
+ </xi:fallback>
+ </xi:include>
<xi:include href="module_specs/Zend_Mail-HtmlMails.xml">
<xi:fallback>
<xi:include href="../en/module_specs/Zend_Mail-HtmlMails.xml" />
View
824 documentation/manual/en/module_specs/Zend_Loader-Autoloader.xml
@@ -1,824 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Reviewed: no -->
-<sect1 id="zend.loader.autoloader">
- <title>The Autoloader</title>
-
- <para>
- <classname>Zend_Loader_Autoloader</classname> introduces a comprehensive
- autoloading solution for Zend Framework. It has been designed with
- several goals in mind:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- Provide a true namespace autoloader. (Previous incarnations
- intercepted all userland namespaces.)
- </para>
- </listitem>
-
- <listitem>
- <para>
- Allow registering arbitrary callbacks as autoloaders, and manage
- them as a stack. (At the time of this writing, this overcomes some
- issues with <code>spl_autoload</code>, which does not allow
- re-registering a callback that utilizes an instance method.)
- </para>
- </listitem>
-
- <listitem>
- <para>
- Allow optimistic matching of namespaces to provide faster class resolution.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- <classname>Zend_Loader_Autoloader</classname> implements a singleton, making it
- unversally accessible. This provides the ability to register additional
- autoloaders from anywhere in your code as necessary.
- </para>
-
- <sect2 id="zend.loader.autoloader.usage">
- <title>Using the Autoloader</title>
-
- <para>
- The first time an instance of the autoloader is retrieved, it
- registers itself with <code>spl_autoload</code>. You retrieve an
- instance using the <methodname>getInstance()</methodname> method:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader = Zend_Loader_Autoloader::getInstance();
-]]></programlisting>
-
- <para>
- By default, the autoloader is configured to match the "Zend_" and
- "ZendX_" namespaces. If you have your own library code that uses
- your own namespace, you may register it with the autoloader using
- the <methodname>registerNamespace()</methodname> method. For instance, if your
- library code is prefixed with "My_", you could do so as follows:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->registerNamespace('My_');
-]]></programlisting>
-
- <note>
- <title>Namespace Prefixes</title>
-
- <para>
- You'll note that the previous example uses "My_" and not "My".
- This is because <classname>Zend_Loader_Autoloader</classname> is intended
- as a general purpose autoloader, and does not make the
- assumption that a given class prefix namespace includes an
- underscore. If your class namespace <emphasis>does</emphasis>
- include one, you should include it when registering your
- namespace.
- </para>
- </note>
-
- <para>
- You can also register arbitrary autoloader callbacks, optionally
- with a specific namespace (or group of namespaces).
- <classname>Zend_Loader_Autoloader</classname> will attempt to match these
- first before using its internal autoloading mechanism.
- </para>
-
- <para>
- As an example, you may want to utilize one or more eZcomponents
- components with your Zend Framework application. To use its
- autoloading capabilities, push it onto the autoloader stack using
- <methodname>pushAutoloader()</methodname>:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->pushAutoloader(array('ezcBase', 'autoload'), 'ezc');
-]]></programlisting>
-
- <para>
- This tells the autoloader to use the eZcomponents autoloader for
- classes beginning with "ezc".
- </para>
-
- <para>
- You can use the <methodname>unshiftAutoloader()</methodname> method to add the
- autoloader to the beginning of the autoloader chain.
- </para>
-
- <para>
- By default, <classname>Zend_Loader_Autoloader</classname> does no error
- suppression when using its internal autoloader, which utilizes
- <methodname>Zend_Loader::loadClass()</methodname>. Most of the time, this is
- exactly what you want. However, there may be cases where you want to
- suppress them. You can do this using
- <methodname>suppressNotFoundWarnings()</methodname>:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->suppressNotFoundWarnings(true);
-]]></programlisting>
-
- <para>
- Finally, there may be times when you want the autoloader to load any
- namespace. For instance, PEAR libraries do not share a common
- namespace, making specifying individual namespaces difficult when
- many PEAR components are in use. You can use the
- <methodname>setFallbackAutoloader()</methodname> method to have the autoloader
- act as a catch-all:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->setFallbackAutoloader(true);
-]]></programlisting>
-
- <note>
- <title>Loading Classes from PHP Namespaces</title>
-
- <para>
- Starting in version 1.10.0, Zend Framework now allows loading classes from
- <acronym>PHP</acronym> namespaces. This support follows the same guidelines and
- implementation as that found in the <ulink
- url="http://groups.google.com/group/php-standards/web/psr-0-final-proposal">PHP
- Framework Interop Group PSR-0</ulink> reference implementation.
- </para>
-
- <para>
- Under this guideline, the following rules apply:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- Each namespace separator is converted to a
- <constant>DIRECTORY_SEPARATOR</constant> when loading from the file system.
- </para>
- </listitem>
-
- <listitem>
- <para>
- Each "_" character in the <emphasis>CLASS NAME</emphasis> is converted to a
- <constant>DIRECTORY_SEPARATOR</constant>. The "_" character has no special
- meaning in the namespace.
- </para>
- </listitem>
-
- <listitem>
- <para>
- The fully-qualified namespace and class is suffixed with ".php" when loading
- from the file system.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- As examples:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- <classname>\Doctrine\Common\IsolatedClassLoader</classname> =&gt;
- <filename>/path/to/project/lib/vendor/Doctrine/Common/IsolatedClassLoader.php</filename>
- </para>
- </listitem>
-
- <listitem>
- <para>
- <classname>\namespace\package\Class_Name</classname> =&gt;
- <filename>/path/to/project/lib/vendor/namespace/package/Class/Name.php</filename>
- </para>
- </listitem>
-
- <listitem>
- <para>
- <classname>\namespace\package_name\Class_Name</classname> =&gt;
- <filename>/path/to/project/lib/vendor/namespace/package_name/Class/Name.php</filename>
- </para>
- </listitem>
- </itemizedlist>
- </note>
- </sect2>
-
- <sect2 id="zend.loader.autoloader.zf-version">
- <title>Selecting a Zend Framework version</title>
-
- <para>
- Typically, you will use the version of Zend Framework that the autoloader you
- instantiate came with. However, when developing a project, it's often useful to track
- specific versions, major or minor branches, or just the latest version.
- <classname>Zend_Loader_Autoloader</classname>, as of version 1.10, offers some features
- to help manage this task.
- </para>
-
- <para>
- Imagine the following scenario:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- During <emphasis>development</emphasis>, you want to track the latest version of
- Zend Framework you have installed, so that you can ensure the application works
- when you upgrade between versions.
- </para>
-
- <para>
- When pushing to <emphasis>Quality Assurance</emphasis>, however, you need to
- have slightly more stability, so you want to use the latest installed revision
- of a specific minor version.
- </para>
-
- <para>
- Finally, when you push to <emphasis>production</emphasis>, you want to pin to a
- specific installed version, to ensure no breakage occurs if or when you add new
- versions of Zend Framework to you server.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- The autoloader allows you to do this with the method
- <methodname>setZfPath()</methodname>. This method takes two arguments, a
- <emphasis>path</emphasis> to a set of Zend Framework installations, and a
- <emphasis>version</emphasis> to use. Once invoked, it prepends a path to the
- <constant>include_path</constant> pointing to the appropriate Zend Framework
- installation library.
- </para>
-
- <para>
- The directory you specify as your <emphasis>path</emphasis> should have a tree such as
- the following:
- </para>
-
- <programlisting language="text"><![CDATA[
-ZendFramework/
-|-- 1.9.2/
-| |-- library/
-|-- ZendFramework-1.9.1-minimal/
-| |-- library/
-|-- 1.8.4PL1/
-| |-- library/
-|-- 1.8.4/
-| |-- library/
-|-- ZendFramework-1.8.3/
-| |-- library/
-|-- 1.7.8/
-| |-- library/
-|-- 1.7.7/
-| |-- library/
-|-- 1.7.6/
-| |-- library/
-]]></programlisting>
-
- <para>
- (where <emphasis>path</emphasis> points to the directory "ZendFramework" in the above
- example)
- </para>
-
- <para>
- Note that each subdirectory should contain the directory <filename>library</filename>,
- which contains the actual Zend Framework library code. The individual subdirectory names
- may be version numbers, or simply be the untarred contents of a standard Zend Framework
- distribution tarball/zipfile.
- </para>
-
- <para>
- Now, let's address the use cases. In the first use case, in
- <emphasis>development</emphasis>, we want to track the latest source install. We can do
- that by passing "latest" as the version:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->setZfPath($path, 'latest');
-]]></programlisting>
-
- <para>
- In the example from above, this will map to the directory
- <filename>ZendFramework/1.9.2/library/</filename>; you can verify this by checking the
- return value of <methodname>getZfPath()</methodname>.
- </para>
-
- <para>
- In the second situation, for <emphasis>quality assurance</emphasis>, let's say we want
- to pin to the 1.8 minor release, using the latest install you have for that release. You
- can do so as follows:
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->setZfPath($path, '1.8');
-]]></programlisting>
-
- <para>
- In this case, it will find the directory
- <filename>ZendFramework/1.8.4PL1/library/</filename>.
- </para>
-
- <para>
- In the final case, for <emphasis>production</emphasis>, we'll pin to a specific version
- -- 1.7.7, since that was what was available when Quality Assurance tested prior to our
- release.
- </para>
-
- <programlisting language="php"><![CDATA[
-$autoloader->setZfPath($path, '1.7.7');
-]]></programlisting>
-
- <para>
- Predictably, it finds the directory <filename>ZendFramework/1.7.7/library/</filename>.
- </para>
-
- <para>
- You can also specify these values in the configuration file you use with
- <filename>Zend_Application</filename>. To do so, you'd specify the following
- information:
- </para>
-
- <programlisting language="ini"><![CDATA[
-[production]
-autoloaderZfPath = "path/to/ZendFramework"
-autoloaderZfVersion = "1.7.7"
-
-[qa]
-autoloaderZfVersion = "1.8"
-
-[development]
-autoloaderZfVersion = "latest"
-]]></programlisting>
-
- <para>
- Note the different environment sections, and the different version specified in each
- environment; these factors will allow <classname>Zend_Application</classname> to
- configure the autoloader appropriately.
- </para>
-
- <warning>
- <title>Performance implications</title>
-
- <para>
- For best performance, either do not use this feature, or specify a specific Zend
- Framework version (i.e., not "latest", a major revision such as "1", or a minor
- revision such as "1.8"). Otherwise, the autoloader will need to scan the provided
- path for directories matching the criteria -- a somewhat expensive operation to
- perform on each request.
- </para>
- </warning>
- </sect2>
-
- <sect2 id="zend.loader.autoloader.interface">
- <title>The Autoloader Interface</title>
-
- <para>
- Besides being able to specify arbitrary callbacks as autoloaders,
- Zend Framework also defines an interface autoloading classes may
- imlement, <classname>Zend_Loader_Autoloader_Interface</classname>:
- </para>
-
- <programlisting language="php"><![CDATA[
-interface Zend_Loader_Autoloader_Interface
-{
- public function autoload($class);
-}
-]]></programlisting>
-
- <para>
- When using this interface, you can simply pass a class instance to
- <classname>Zend_Loader_Autoloader</classname>'s
- <methodname>pushAutoloader()</methodname>
- and <methodname>unshiftAutoloader()</methodname> methods:
- </para>
-
- <programlisting language="php"><![CDATA[
-// Assume Foo_Autoloader implements Zend_Loader_Autoloader_Interface:
-$foo = new Foo_Autoloader();
-
-$autoloader->pushAutoloader($foo, 'Foo_');
-]]></programlisting>
- </sect2>
-
- <sect2 id="zend.loader.autoloader.reference">
- <title>Autoloader Reference</title>
-
- <para>
- Below, please find a guide to the methods available in
- <classname>Zend_Loader_Autoloader</classname>.
- </para>
-
- <table id="zend.loader.autoloader.reference.api">
- <title>Zend_Loader_Autoloader Methods</title>
-
- <tgroup cols="4">
- <thead>
- <row>
- <entry>Method</entry>
- <entry>Return Value</entry>
- <entry>Parameters</entry>
- <entry>Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><methodname>getInstance()</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
- <entry>N/A</entry>
-
- <entry>
- <para>
- Retrieve the <classname>Zend_Loader_Autoloader</classname>
- singleton instance. On first retrieval, it registers
- itself with <code>spl_autoload</code>. This method is static.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>resetInstance()</methodname></entry>
- <entry><code>void</code></entry>
- <entry>N/A</entry>
-
- <entry>
- <para>
- Resets the state of the
- <classname>Zend_Loader_Autoloader</classname> singleton instance to
- it's original state, unregistering all autoloader callbacks and all
- registered namespaces.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>autoload($class)</methodname></entry>
- <entry><code>string|<constant>FALSE</constant></code></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$class</varname>, <emphasis>required</emphasis>.
- A string class name to load.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>Attempt to resolve a class name to a file and load it.</para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>setDefaultAutoloader($callback)</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$callback</varname>, <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Specify an alternate <acronym>PHP</acronym> callback to use for the
- default autoloader implementation.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>getDefaultAutoloader()</methodname></entry>
- <entry><code>callback</code></entry>
- <entry>N/A</entry>
-
- <entry>
- <para>
- Retrieve the default autoloader implementation; by default, this is
- <methodname>Zend_Loader::loadClass()</methodname>.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>setAutoloaders(array $autoloaders)</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$autoloaders</varname>,
- <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Set a list of concrete autoloaders to use in the
- autoloader stack. Each item in the autoloaders array
- must be a <acronym>PHP</acronym> callback.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>getAutoloaders()</methodname></entry>
- <entry><type>Array</type></entry>
- <entry>N/A</entry>
- <entry><para>Retrieve the internal autoloader stack.</para></entry>
- </row>
-
- <row>
- <entry><methodname>getNamespaceAutoloaders($namespace)</methodname></entry>
- <entry><type>Array</type></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$namespace</varname>, <emphasis>required</emphasis>
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Fetch all autoloaders that have registered to load a
- specific namespace.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>registerNamespace($namespace)</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$namespace</varname>,
- <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Register one or more namespaces with the default
- autoloader. If <varname>$namespace</varname> is a string,
- it registers that namespace; if it's an array of
- strings, registers each as a namespace.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>unregisterNamespace($namespace)</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$namespace</varname>,
- <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Unregister one or more namespaces from the default
- autoloader. If <varname>$namespace</varname> is a string,
- it unregisters that namespace; if it's an array of
- strings, unregisters each as a namespace.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>getRegisteredNamespaces()</methodname></entry>
- <entry><type>Array</type></entry>
- <entry>N/A</entry>
-
- <entry>
- <para>
- Returns an array of all namespaces registered with the default
- autoloader.
- </para>
- </entry>
- </row>
-
- <row>
- <entry>
- <methodname>suppressNotFoundWarnings($flag = null)</methodname>
- </entry>
-
- <entry><code>boolean|Zend_Loader_Autoloader</code></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$flag</varname>, <emphasis>optional</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Set or retrieve the value of the flag used to
- indicate whether the default autoloader
- implementation should suppress "file not found"
- warnings. If no arguments or a <constant>NULL</constant> value is
- passed, returns a boolean indicating the status of the flag;
- if a boolean is passed, the flag is set to that
- value and the autoloader instance is returned (to
- allow method chaining).
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>setFallbackAutoloader($flag)</methodname></entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$flag</varname>, <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Set the value of the flag used to indicate whether
- or not the default autoloader should be used as a
- fallback or catch-all autoloader for all namespaces.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>isFallbackAutoloader()</methodname></entry>
- <entry><type>Boolean</type></entry>
- <entry>N/A</entry>
- <entry>
- <para>
- Retrieve the value of the flag used to indicate whether
- or not the default autoloader should be used as a
- fallback or catch-all autoloader for all namespaces.
- By default, this is <constant>FALSE</constant>.
- </para>
- </entry>
- </row>
-
- <row>
- <entry><methodname>getClassAutoloaders($class)</methodname></entry>
- <entry><type>Array</type></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$class</varname>, <emphasis>required</emphasis>.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Get the list of namespaced autoloaders that could
- potentially match the provided class. If none match,
- all global (non-namespaced) autoloaders are returned.
- </para>
- </entry>
- </row>
-
- <row>
- <entry>
- <methodname>unshiftAutoloader($callback, $namespace = '')</methodname>
- </entry>
-
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$callback</varname>, <emphasis>required</emphasis>.
- A valid <acronym>PHP</acronym> callback
- </para>
- </listitem>
-
- <listitem>
- <para>
- <varname>$namespace</varname>,
- <emphasis>optional</emphasis>. A string representing a class
- prefix namespace.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Add a concrete autoloader implementation to the
- beginning of the internal autoloader stack. If a
- namespace is provided, that namespace will be used
- to match optimistically; otherwise, the autoloader
- will be considered a global autoloader.
- </para>
- </entry>
- </row>
-
- <row>
- <entry>
- <methodname>pushAutoloader($callback, $namespace = '')</methodname>
- </entry>
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$callback</varname>, <emphasis>required</emphasis>.
- A valid <acronym>PHP</acronym> callback
- </para>
- </listitem>
-
- <listitem>
- <para>
- <varname>$namespace</varname>,
- <emphasis>optional</emphasis>. A string representing a class
- prefix namespace.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Add a concrete autoloader implementation to the
- end of the internal autoloader stack. If a
- namespace is provided, that namespace will be used
- to match optimistically; otherwise, the autoloader
- will be considered a global autoloader.
- </para>
- </entry>
- </row>
-
- <row>
- <entry>
- <methodname>removeAutoloader($callback, $namespace = '')</methodname>
- </entry>
-
- <entry><classname>Zend_Loader_Autoloader</classname></entry>
-
- <entry>
- <itemizedlist>
- <listitem>
- <para>
- <varname>$callback</varname>, <emphasis>required</emphasis>.
- A valid <acronym>PHP</acronym> callback
- </para>
- </listitem>
-
- <listitem>
- <para>
- <varname>$namespace</varname>,
- <emphasis>optional</emphasis>. A string representing a class
- prefix namespace, or an array of namespace strings.
- </para>
- </listitem>
- </itemizedlist>
- </entry>
-
- <entry>
- <para>
- Remove a concrete autoloader implementation from
- the internal autoloader stack. If a namespace or
- namespaces are provided, the callback will be
- removed from that namespace or namespaces only.
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
-</sect1>
View
171 documentation/manual/en/module_specs/Zend_Loader-AutoloaderFactory.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.loader.autoloader-factory">
+ <title>The AutoloaderFactory</title>
+
+ <sect2 id="zend.loader.autoloader-factory.intro">
+ <title>Overview</title>
+
+ <para>
+ Starting with version 2.0, Zend Framework now offers multiple autoloader strategies.
+ Often, it will be useful to employ multiple autoloading strategies; as an example, you
+ may have a class map for your most used classes, but want to use a PSR-0 style
+ autoloader for 3rd party libraries.
+ </para>
+
+ <para>
+ While you could potentially manually configure these, it may be more useful to define
+ the autoloader configuration somewhere and cache it. For these cases, the
+ <classname>AutoloaderFactory</classname> will be useful.
+ </para>
+ </sect2>
+
+ <sect2 id="zend.loader.autoloader-factory.quick-start">
+ <title>Quick Start</title>
+
+ <para>
+ Configuration may be stored as a PHP array, or in some form of configuration file. As an
+ example, consider the following PHP array:
+ </para>
+
+ <programlisting lang="php"><![CDATA[
+$config = array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ 'application' => APPLICATION_PATH . '/.classmap.php',
+ 'zf' => APPLICATION_PATH . '/../library/Zend/.classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ 'Phly\Mustache' => APPLICATION_PATH . '/../library/Phly/Mustache',
+ 'Doctrine' => APPLICATION_PATH . '/../library/Doctrine',
+ ),
+ ),
+);
+]]></programlisting>
+
+ <para>
+ An equivalent INI-style configuration might look like the following:
+ </para>
+
+ <programlisting lang="ini"><![CDATA[
+Zend\Loader\ClassMapAutoloader.application = APPLICATION_PATH "/.classmap.php"
+Zend\Loader\ClassMapAutoloader.zf = APPLICATION_PATH "/../library/Zend/.classmap.php"
+Zend\Loader\StandardAutoloader.namespaces.Phly\Mustache = APPLICATION_PATH "/../library/Phly/Mustache"
+Zend\Loader\StandardAutoloader.namespaces.Doctrine = APPLICATION_PATH "/../library/Doctrine"
+]]></programlisting>
+
+ <para>
+ Once you have your configuration in a PHP array, you simply pass it to the
+ <classname>AutoloaderFactory</classname>.
+ </para>
+
+ <programlisting lang="php"><![CDATA[
+// This example assumes ZF is on your include_path.
+// You could also load the factory class from a path relative to the
+// current script, or via an absolute path.
+require_once 'Zend/Loader/AutoloaderFactory.php';
+Zend\Loader\AutoloaderFactory::factory($config);
+]]></programlisting>
+
+ <para>
+ The <classname>AutoloaderFactory</classname> will instantiate each autoloader with the
+ given options, and also call its <methodname>register()</methodname> method to register
+ it with the SPL autoloader.
+ </para>
+ </sect2>
+
+ <sect2 id="zend.loader.autoloader-factory.options">
+ <title>Configuration Options</title>
+
+ <variablelist>
+ <title>AutoloaderFactory Options</title>
+
+ <varlistentry>
+ <term>$options</term>
+
+ <listitem>
+ <para>
+ The <classname>AutoloaderFactory</classname> expects an associative array or
+ <interfacename>Traversable</interfacename> object. Keys should be valid
+ autoloader class names, and the values should be the options that should be
+ passed to the class constructor.
+ </para>
+
+ <para>
+ Internally, the <classname>AutoloaderFactory</classname> checks to see if
+ the autoloader class referenced exists. If not, it will use the <link
+ linkend="zend.loader.standard-autoloader">StandardAutoloader</link> to
+ attempt to load the class via the <varname>include_path</varname> (or, in
+ the case of "Zend"-namespaced classes, using the Zend Framework library
+ path). If the class is not found, or does not implement the
+ <link linkend="zend.loader.spl-autoloader">SplAutoloader</link> interface,
+ an exception will be raised.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect2>
+
+ <sect2 id="zend.loader.autoloader-factory.methods">
+ <title>Available Methods</title>
+
+ <refentry id="zend.loader.autoloader-factory.methods.factory">
+ <refnamediv>
+ <refname>factory</refname>
+ <refpurpose>Instantiate and register autoloaders</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>factory</methodname>
+ <methodparam>
+ <funcparams>$options</funcparams>
+ </methodparam>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>factory()</title>
+
+ <para>
+ This method is <emphasis>static</emphasis>, and is used to instantiate
+ autoloaders and register them with the SPL autoloader. It expects either an
+ array or <interfacename>Traversable</interfacename> object as denoted in the
+ <link linkend="zend.loader.autoloader-factory.options">Options section</link>.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="zend.loader.autoloader-factory.methods.get-registered-autoloaders">
+ <refnamediv>
+ <refname>getRegisteredAutoloaders</refname>
+ <refpurpose>Retrieve a list of all autoloaders registered using the factory</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>getRegisteredAutoloaders</methodname>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>getRegisteredAutoloaders()</title>
+
+ <para>
+ This method is <emphasis>static</emphasis>, and may be used to retrieve a list
+ of all autoloaders registered via the <methodname>factory()</methodname> method.
+ It returns simply an array of autoloader instances.
+ </para>
+ </refsect1>
+ </refentry>
+ </sect2>
+
+ <sect2 id="zend.loader.autoloader-factory.examples">
+ <title>Examples</title>
+
+ <para>
+ Please see the <link linkend="zend.loader.autoloader-factory.quick-start">Quick
+ Start</link> for a detailed example.
+ </para>
+ </sect2>
+</sect1>
View
212 documentation/manual/en/module_specs/Zend_Loader-Broker.xml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.loader.broker">
+ <title>The Broker Interface</title>
+
+ <sect2 id="zend.loader.broker.intro">
+ <title>Overview</title>
+
+ <para>
+ Withing Zend Framework, a number of components have a need to:
+ </para>
+
+ <itemizedlist>
+ <listitem><para>Dynamically load adapters, helpers, or other plugins</para></listitem>
+
+ <listitem>
+ <para>
+ Allow specifying such adapters, helpers, and plugins by a "short name" variant,
+ in order to allow overriding defaults; in other words, to allow slipstreaming
+ custom variants into the component.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ The <interfacename>Broker</interfacename> interface provides a simple contract for
+ managing these extensions. At its simplest, it allows you to register and unregister
+ concrete extension instances, mapping them to a short name. For added flexibility, it
+ allows specifying a <link linkend="zend.loader.short-name-locater">plugin class
+ loader</link> that may be used to resolve the short names to class names, and thus
+ dynamically resolve the name to a new class instance.
+ </para>
+
+ <para>
+ A concrete implementation of this interface is provided with <link
+ linkend="zend.loader.plugin-broker">the PluginBroker class</link>.
+ </para>
+ </sect2>
+
+ <sect2 id="zend.loader.broker.quick-start">
+ <title>Quick Start</title>
+
+ <para>
+ A concrete interface must simply follow the contract as specified in the interface:
+ </para>
+
+ <programlisting language="php"><![CDATA[
+namespace Zend\Loader;
+interface Broker
+{
+ public function load($plugin, array $options = null);
+ public function register($name, $plugin);
+ public function unregister($name);
+ public function setClassLoader(ShortNameLocater $loader);
+ public function getClassLoader();
+}
+]]></programlisting>
+ </sect2>
+
+ <sect2 id="zend.loader.broker.options">
+ <title>Configuration Options</title>
+
+ <para>
+ This component defines no configuration options, as it is an interface.
+ </para>
+ </sect2>
+
+ <sect2 id="zend.loader.broker.methods">
+ <title>Available Methods</title>
+
+ <refentry id="zend.loader.broker.methods.load">
+ <refnamediv>
+ <refname>load</refname>
+ <refpurpose>Locate and return a plugin instance</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>load</methodname>
+ <methodparam>
+ <funcparams>$plugin, array $options = null</funcparams>
+ </methodparam>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>load()</title>
+
+ <para>
+ <methodname>load()</methodname> is intended to do the heavy lifting of the
+ broker. The <varname>$plugin</varname> argument should be a short name,
+ preferably case-insensitive, describing the plugin to load. The broker's
+ responsibility is then to return an instance of the appropriate plugin. For new
+ instances, the <varname>$options</varname> argument can be used to seed and
+ configure the plugin.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="zend.loader.broker.methods.register">
+ <refnamediv>
+ <refname>register</refname>
+ <refpurpose>Register a plugin</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>register</methodname>
+ <methodparam>
+ <funcparams>$name, $plugin</funcparams>
+ </methodparam>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>register()</title>
+
+ <para>
+ <methodname>register()</methodname> allows explicitly registering a plugin with
+ the broker. The provided <varname>$name</varname> will be used to refer to the
+ plugin later via <methodname>load()</methodname> or
+ <methodname>unregister()</methodname>. <varname>$plugin</varname> may be either
+ a string class name or an object instance; the implementation will determine
+ usage.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="zend.loader.broker.methods.unregister">
+ <refnamediv>
+ <refname>unregister</refname>
+ <refpurpose>Unregister a plugin from the broker</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>unregister</methodname>
+ <methodparam>
+ <funcparams>$name</funcparams>
+ </methodparam>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>unregister()</title>
+
+ <para>
+ Used to remove a plugin from the broker. Based on the implementation, this may
+ simply remove a previous instance registered in the broker, or it may prevent
+ ever loading it again.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="zend.loader.broker.methods.set-class-loader">
+ <refnamediv>
+ <refname>setClassLoader</refname>
+ <refpurpose>Specify a class loader to be used for plugin class lookups</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>setClassLoader</methodname>
+ <methodparam>
+ <funcparams>Zend\Loader\ShortNameLocater $loader</funcparams>
+ </methodparam>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>setClassLoader()</title>
+
+ <para>
+ Plugins are supposed to be dynamic, overridable functionality. A class loader is
+ used to dynamically determine what plugin class to use when a given plugin is
+ retrieved from the broker. This method allows you to specify what implementation
+ to utilize.
+ </para>
+ </refsect1>
+ </refentry>
+
+ <refentry id="zend.loader.broker.methods.get-class-loader">
+ <refnamediv>
+ <refname>getClassLoader</refname>
+ <refpurpose>Retrieve the plugin class loader</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <methodsynopsis>
+ <methodname>getClassLoader</methodname>
+ </methodsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>getClassLoader()</title>
+
+ <para>
+ Retrieves the currently registered plugin class loader.
+ </para>
+ </refsect1>
+ </refentry>
+ </sect2>
+
+ <sect2 id="zend.loader.broker.examples">
+ <title>Examples</title>
+
+ <para>
+ Please see the <link linkend="zend.loader.broker.quick-start">Quick Start</link> for the
+ interface specification.
+ </para>
+ </sect2>
+</sect1>
View
357 documentation/manual/en/module_specs/Zend_Loader-ClassMapAutoloader.xml
@@ -0,0 +1,357 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect1 id="zend.loader.class-map-autoloader">
+ <title>The ClassMapAutoloader</title>
+
+ <sect2 id="zend.loader.class-map-autoloader.intro">
+ <title>Overview</title>
+
+ <para>
+ The <classname>ClassMapAutoloader</classname> is designed with performance in mind. The
+ idea behind it is simple: when asked to load a class, see if it's in the map, and, if
+ so, load the file associated with the class in the map. This avoids unnecessary
+ filesystem operations, and can also ensure the autoloader "plays nice" with opcode
+ caches and PHP's realpath cache.
+ </para>
+
+ <para>
+ In order to use the <classname>ClassMapAutoloader</classname>, you first need class
+ maps. Zend Framework ships with a class map per component or, if you grabbed the entire
+ ZF distribution, a class map for the entire Zend Framework. These maps are typically in
+ a file named <filename>.classmap.php</filename> within either the "Zend" directory, or
+ an individual component's source directory.
+ </para>
+
+ <para>
+ Zend Framework also provides a tool for generating these class maps; you can find it in
+ <filename>bin/classmap_generator.php</filename> of the distribution. Full documentation
+ of this too is provided in <xref linkend="zend.loader.classmap-generator" />.
+ </para>
+ </sect2>
+
+ <sect2 id="zend.loader.class-map-autoloader.quick-start">
+ <title>Quick Start</title>
+
+ <para>
+ The first step is to generate a class map file. You may run this over any directory
+ containing source code anywhere underneath it.
+ </para>
+
+ <programlisting language="sh"><![CDATA[
+php classmap_generator.php Some/Directory/
+]]></programlisting>
+
+ <para>
+ This will create a file named <filename>Some/Directory/.classmap.php</filename>, which
+ is a PHP file returning an associative array that represents the class map.
+ </para>
+
+ <para>
+ Within your code, you will now instantiate the
+ <classname>ClassMapAutoloader</classname>, and provide it the location of the map.
+ </para>
+
+ <programlisting language="php"><![CDATA[
+// This example assumes ZF is on your include_path.
+// You could also load the autoloader class from a path relative to the
+// current script, or via an absolute path.
+require_once 'Zend/Loader/ClassMapAutoloader.php';