[wp-trac] [WordPress Trac] #36335: Next generation: core autoloader proposal

WordPress Trac noreply at wordpress.org
Tue May 17 15:52:15 UTC 2016


#36335: Next generation: core autoloader proposal
-----------------------------+-----------------------------
 Reporter:  dnaber-de        |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+-----------------------------

Comment (by atimmer):

 I think the most important thing about the autoloader is that WordPress
 should eventually move towards PSR-4. The reasons being that
 interoperability is important and the PHP community has done a lot of work
 in this field and I think we should follow their lead. This depends on
 dropping PHP5.2 support and moving classes to their correct folder.

 The biggest thing we can do in the meantime is to remove the expectation
 of people that they have to require a file to use a certain class. So
 anyone writing code will be comfortable with just writing: new
 Class_That_Has_Not_Been_Loaded_Yet(). Because of this reason, I think we
 should implement a class map autoloader which lets developers just do new
 Class(); anywhere they like. Then once we drop PHP5.2 we can just switch
 all new classes to PSR-4.

 I don't have a strong opinion about composer vs custom because the
 eventual goal should be PSR-4 which is the same and the user can ignore
 the specific implementation because it is a standard.

 Another thing: When we make a class map, I think it is a wise choice to
 make the generation of the class map automated. That will prevent a lot of
 headaches later on when we start moving files.

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


More information about the wp-trac mailing list