<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://mirmodynamics.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Mirmo Dynamics - Tag - plugins</title>
  <link>http://mirmodynamics.com/</link>
  <atom:link href="http://mirmodynamics.com/feed/tag/plugins/rss2" rel="self" type="application/rss+xml"/>
  <description>Rien de grand ne se fit jamais sans enthousiasme.</description>
  <language>en</language>
  <pubDate>Wed, 03 Dec 2008 17:01:33 +0100</pubDate>
  <copyright>2003-2008 &amp;copy; Geoffrey Bachelet</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Of controller plugins and directory layout</title>
    <link>http://mirmodynamics.com/post/2007/09/22/A-word-on-controller-plugins</link>
    <guid isPermaLink="false">urn:md5:efefaa9aeeee587e18314a690c4ac04a</guid>
    <pubDate>Sun, 23 Sep 2007 00:55:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>controllers</category><category>directory layout</category><category>modules</category><category>plugins</category><category>zend framework</category>    
    <description>    &lt;p&gt;When anyone on #zftalk ask about where controller plugins should be kept, we usually responds something like &lt;em&gt;have your own library namesapce alongside Zend/ and put it in it like &lt;code&gt;YourNamespace/Controller/Plugin/YourPlugin.php&lt;/code&gt;&lt;/em&gt;. But what about application specific controllers ? There's a time where you have to write a plugin that relies on the application at such a level that using it elsewhere would make no sense. In that case, where can we store this plugin ? The question arised this morning, and we ended up to the fact that having a controller-level plugin directory would not hurt, after all. So one could have the following directory layout (simplified on purpose):&lt;/p&gt;

&lt;pre&gt;
/application/modules/default
    /controllers
    /library/Plugin
        MyPlugin.php
&lt;/pre&gt;


&lt;p&gt;The drawback is that in order to use autoload you would have to have each modules &lt;code&gt;Plugin&lt;/code&gt; dir in the include path, which is a bit of a hassle. Instead, we could have the much more simple folloing layout:&lt;/p&gt;

&lt;pre&gt;
/application
    library/Controller/Plugin
        MyPlugin.php
&lt;/pre&gt;


&lt;p&gt;Which is simpler but does not allow for modules specific plugins. Anyway, the former layout would require a bit more logic in the bootstrap in order to extract every modules path as plugins are registered pre-dispatch.&lt;/p&gt;


&lt;p&gt;Hope it helps with directory layout organization :-)&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;What I've finally decided to do is the following:&lt;/p&gt;

&lt;pre&gt;
/application
    library/App/Controller/Plugin
        MyPlugin.php
&lt;/pre&gt;


&lt;p&gt;So that application specific code gets prefixed with the &lt;code&gt;App_&lt;/code&gt; namespace.&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/09/22/A-word-on-controller-plugins#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/09/22/A-word-on-controller-plugins#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1038</wfw:commentRss>
      </item>
    
</channel>
</rss>