Autoloading Classes |
What is the best way to autoload custom classes from the libraries folder? I remember in CI3 you simply submitted an array of them in the config/autoload.php file. I looked this up in the docs, and saw $classmap, but it doesn't seem to work. The docs suggest using:
'ClassName' => APPPATH . 'Libraries/ClassName.php' but that doesn't work. My custom libraries are namespaced App\Libraries and I don't want to keep repeating use statements in my controllers, because I have like 25 libraries I use in every controller. What is the new best practice fr this in CL4? (01-26-2021, 07:16 PM)grundskull Wrote: What is the best way to autoload custom classes from the libraries folder? I remember in CI3 you simply submitted an array of them in the config/autoload.php file. I looked this up in the docs, and saw $classmap, but it doesn't seem to work. The docs suggest using: Define the libraries in the base controller constructor. And inherit other controllers from it. 25 libraries ?? I'm scared )
I' am also scared, 25 classes needs refactoring.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |