[wp-trac] [WordPress Trac] #43979: PSR-4 Autoloader
WordPress Trac
noreply at wordpress.org
Sun May 6 02:21:07 UTC 2018
#43979: PSR-4 Autoloader
-------------------------------------+-----------------------------
Reporter: alicewondermiscreations | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------------------+-----------------------------
WordPress really needs a PSR-4 autoloader.
With a PSR-4 autoloader, plugins and classes could require a namespaced
class and it would load on demand.
This would solve #43898 because what I want there can be solved with a
class, in fact I'm doing that now on three blogs running it as an mu-
plugin - but mu-plugins can't be updated automatically, they can only
manually updated.
Things like TGMPA that you find used in many plugins / themes could be
loaded that way, instead of needing many copies in each plugin / theme
that wants it.
A PSR-4 autoloader would give a way that a plugin or theme could use a
third party API without needing to bundle the API itself.
I would suggest wp-content/wp-psr as the directory - with vendor/product
directory structure inside, and PSR-4 class installer/updater similar to
the plugin/theme installer/updater.
Some things in core could even likely be moved into it.
But anyway a PSR-4 autoloader would solve the issue of some things needing
to be in mu-plugins for no other reasons than to make sure they are
loaded, and could also be used to take some eye candy out of core that can
be loaded that way.
A PSR-4 autoloader would be a single file and could work with every
version of PHP that still received security fixes from upstream PHP.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43979>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list