Re: Not autoloading functions

From: Date: Sun, 29 Jan 2017 16:18:54 +0000
Subject: Re: Not autoloading functions
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-98020@lists.php.net to get a copy of this message
On 29/01/2017 15:37, Wes wrote:
Curious that those who are posting here put all functions in the same file. So, why don't you just require_once('Namespace/functions.php') ?
By that argument, why not just require_once('Namespace/ClassName.php)? It turns out that many people find autoloading a much more convenient and manageable solution. In particular, the standardisation of autoloading provided by PSR-0 and PSR-4 has been central to the success of Composer, and the ecosystem of reusable components that it promotes. Autoloading functions, either one by one, or namespace by namespace, is a logical extension of that, with all the same benefits. Unfortunately, it has some unique complications due to the way PHP resolves namespaced vs global function names. Please have a look through the archives of the list if you want to know more; there's been too much discussion already to re-hash it all here. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#98020) next »