[wp-trac] [WordPress Trac] #36335: Next generation: core autoloader proposal
WordPress Trac
noreply at wordpress.org
Wed Jul 6 13:43:18 UTC 2022
#36335: Next generation: core autoloader proposal
-----------------------------+------------------------------
Reporter: dnaber-de | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+------------------------------
Comment (by lucasbustamante):
I have read through the whole discussion so far, it has been...
enlightening.
I think whatever autoloader we implement, it should solve two main issues
for Plugins (and maybe Themes):
- Avoid class conflicts
- Resolve dependency tree
For instance:
Plugin A dependencies.json:
{{{
{
"require": {
"psr/container": "1.0.0",
}
}
}}}
Plugin B dependencies.json:
{{{
{
"require": {
"psr/container": "^1.0 || ^2.0",
}
}
}}}
When installing Plugin B, it should ideally install psr/container 2.0 if
the current environment supports it. When installing plugin A, it should
revert back to psr/container 1.0, as it is an accepted dependency by both
plugins.
Now suppose we want to install Plugin C:
{{{
{
"require": {
"psr/container": "^3",
}
}
}}}
Since Plugin C's dependency cannot be conciliated with Plugin A and B, it
should not be possible to install it.
This will be a truly compatible PSR-4 autoloader and dependency resolution
process in WordPress Core that the ecosystem and developers can rely on.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36335#comment:257>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list