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

WordPress Trac noreply at wordpress.org
Tue Feb 11 12:16:48 UTC 2014


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

Comment (by dave1010):

 I've updated the summary to include PSR-4 now, not that it makes a lot of
 difference.

 Would the API that plugins used to get hold of the autoloader look
 something like this?

 {{{
 $GLOBALS['wp_autoloader']->addNamespace('Acme', __DIR__ . '/src');
 }}}


 Without trying to derail this ticket, it would be worth considering making
 it easier to integrate with composer in the long term.
 http://wpackagist.org/ already exists and seems to be very popular (but
 obviously can't be used in all cases).

 It would be great if plugins could have a simple file (e.g.
 `autoload.json`, in the same format as the `autoload` section in
 `composer.json`) that WordPress picked up automatically.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21300#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list