plugins-intro.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="learning.plugins.intro">
  4. <title>Introduction</title>
  5. <para>
  6. Zend Framework makes heavy use of plugin architectures. Plugins allow for easy extensibility
  7. and customization of the framework while keeping your code separate from Zend Framework's
  8. code.
  9. </para>
  10. <para>
  11. Typically, plugins in Zend Framework work as follows:
  12. </para>
  13. <itemizedlist>
  14. <listitem>
  15. <para>
  16. Plugins are classes. The actual class definition will vary based on the component --
  17. you may need to extend an abstract class or implement an interface, but the fact
  18. remains that the plugin is itself a class.
  19. </para>
  20. </listitem>
  21. <listitem>
  22. <para>
  23. Related plugins will share a common class prefix. For instance, if you have created
  24. a number of view helpers, they might all share the class prefix
  25. "<classname>Foo_View_Helper_</classname>".
  26. </para>
  27. </listitem>
  28. <listitem>
  29. <para>
  30. Everything after the common prefix will be considered the <emphasis>plugin
  31. name</emphasis> or <emphasis>short name</emphasis> (versus the "long name",
  32. which is the full classname). For example, if the plugin prefix is
  33. "<classname>Foo_View_Helper_</classname>", and the class name is
  34. "<classname>Foo_View_Helper_Bar</classname>", the plugin name will be simply
  35. "<classname>Bar</classname>".
  36. </para>
  37. </listitem>
  38. <listitem>
  39. <para>
  40. Plugin names are typically case sensitive. The one caveat is that the initial letter
  41. can often be either lower or uppercase; in our previous example, both "bar" and
  42. "Bar" would refer to the same plugin.
  43. </para>
  44. </listitem>
  45. </itemizedlist>
  46. <para>
  47. Now let's turn to using plugins.
  48. </para>
  49. </sect1>