autoloading-intro.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="learning.autoloading.intro">
  4. <title>Introduction</title>
  5. <para>
  6. Autoloading is a mechanism that eliminates the need to manually require dependencies within
  7. your <acronym>PHP</acronym> code. Per <ulink url="http://php.net/autoload">the PHP
  8. autoload manual</ulink>, once an autoloader has been defined, it "is automatically called
  9. in case you are trying to use a class or an interface which hasn't been defined yet."
  10. </para>
  11. <para>
  12. Using autoloading, you do not need to worry about <emphasis>where</emphasis> a class exists
  13. in your project. With well-defined autoloaders, you do not need to worry about where a class
  14. file is relative to the current class file; you simply use the class, and the autoloader
  15. will perform the file lookup.
  16. </para>
  17. <para>
  18. Additionally, autoloading, because it defers loading to the last possible moment and ensures
  19. that a match only has to occur once, can be a huge performance boost -- particularly if you
  20. take the time to strip out <methodname>require_once()</methodname> calls before you move
  21. to deployment.
  22. </para>
  23. <para>
  24. Zend Framework encourages the use of autoloading, and provides several tools to provide
  25. autoloading of both library code as well as application code. This tutorial covers these
  26. tools, as well as how to use them effectively.
  27. </para>
  28. </sect1>