[wp-trac] [WordPress Trac] #60414: Core PHP autoloader proposal
WordPress Trac
noreply at wordpress.org
Thu Aug 1 09:21:35 UTC 2024
#60414: Core PHP autoloader proposal
-------------------------------------+-------------------------------------
Reporter: aristath | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit- | Focuses: performance,
tests early | sustainability
-------------------------------------+-------------------------------------
Comment (by aristath):
> Why was composer rejected in the first place?
Composer was not "rejected". However, the whole Composer debate derailed
the conversation multiple times, and delayed the effort to add an
autoloader in Core for years.
Let's first get a basic implementation merged before we re-ignite that
debate.
I tried to explain the reasoning in the
[https://make.wordpress.org/core/?p=110295 proposal on make.w.org]:
> Since the Composer vs non-composer autoloader was one of the main points
of discussion in the 8-year-old ticket, it’s worth mentioning here, and
clarify some points:
>
> Composer is a very mature and safe way to autoload classes. However,
this initial implementation does not use it.
>
> This proposal is for a minimally invasive, performance-optimized change.
It implements autoloading using a hardcoded classMap. Still, It does take
care of all the preliminary work so if it is decided that a Composer
autoloader is what we want to do, then switching to that will be a
relatively easy task. The current PR has a very narrow focus and serves as
the first step towards modernizing the WP codebase.
>
> Composer would allow us to automate generating the autoloader, so if
deemed appropriate, we could modify the current proposal to implement
that.
>
> Adding an initial, minimal autoloader will not block a future Composer
implementation. It is easier to start without it, and then add it if we
find that we need it. Doing the reverse could prove more difficult, so
this path was deemed safer as a first step.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60414#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list