[wp-trac] [WordPress Trac] #21300: Implement autoloader compatible with PSR-0 for plugins and themes

WordPress Trac noreply at wordpress.org
Sat Sep 21 16:17:01 UTC 2013


#21300: Implement autoloader compatible with PSR-0 for plugins and themes
-----------------------------+------------------------------
 Reporter:  dave1010         |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------

Comment (by rmccue):

 Replying to [comment:7 MikeSchinkel]:
 > Questions regarding this proposal: Assuming that autoloaders were
 enabled for plugins and themes, would that mean that each plugin and theme
 would move their libraries into a single autoload directory outside of
 their own plugin and/or theme directory, or would each plugin and/or theme
 would have their own directory(s) that they would have autoloaded?

 The latter, I assume. This would more just be an implementation of PSR-0
 that plugins and themes can use, the way I see it.

 > If the latter, for sites with more than a few plugins would that not
 result in performance concerns where the autoloader has to test the file
 system for file existence across many different directories every time it
 needs to load a file?  Would that not too be problematic?

 Most PSR-0 compliant libraries have you register a "prefix" which maps to
 a directory. For example, I might say that anything with the prefix
 `rmccue_MyPlugin_` lives in `myplugin/library/rmccue/MyPlugin/`. This
 moves it from a `file_exists` to a `strpos` check, which is comparatively
 cheap.

 +1 for this feature, by the way. I have to reimplement it in basically
 every plugin I have. Happy to write a patch if we're +1 on this.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/21300#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list