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]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php