Also, is there a way to autoload these functions in the same way that classes automatically load?
Not for global functions, but if ...
Is there a best practice for posting functions with names?
I would think about using objects instead of βbest practice,β however we all know that this is not entirely true.
There is no autoload for global functions, you can encapsulate functions in classes as static functions, and then the autoloader will take effect. So this may be a suggestion, however, you should clearly understand the implications that static functions have for your overall design.
So to speak: if you are in order with global functions, then you can be in order with global static functions of a class. They will be broken if you change the class name (for example, with any global function name), however, you created something that can automatically load and is compatible with your file naming scheme.
Edit: When I write global, I mean the full name of the function that starts with \ . See Doc Name Resolution Rules .
hakre source share