Welcome Guest, Not a member yet? Register   Sign In
Suggestion : SPL Autoload config
#1

(This post was last modified: 09-07-2015, 04:19 AM by djha.)

Hi,

Actually, loading a class is only possible by "CI_Loader" class.
It will be interesting to disable this feature and use "spl_autoload_register".

An option $config['spl_autoload'] with a function value (class & method) that allow to autoload your own classes.
Then you can decide the naming convention & folders hierarchy.

Possible custom naming example :

Code:
class "MY_Storage_Adapter_File" store in "MY/Storage/Adapter/File.php"
autoload : $file_path = str_replace('_', '/', $class);

That's mean PSR-0 or PSR-4 autoloading ...

M.
Reply


Messages In This Thread
Suggestion : SPL Autoload config - by djha - 09-07-2015, 04:09 AM
RE: Suggestion : SPL Autoload config - by djha - 09-08-2015, 03:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB