Reputation: 2227
I have the custom autoloader function in autoload-my-func.php
file.
I want to use vendor/autoload.php
- for composer files, but only my autoload-my-func.php
for classes with my custom namespace. (My_Custom_Namespace)
Upvotes: 0
Views: 1833
Reputation: 4400
I want to use vendor/autoload.php - for composer files, but only my autoload-my-func.php for classes with my custom namespace. (My_Custom_Namespace)
You should use composer's auto loader for both and define your custom namespace in your composer.json file. If you are stuck with a poorly designed legacy system, and you need something to bridge a gulf of stupidity until you can create a better solution, then you should take a look at the documentation for spl_autoload_register. Specifically, the line about "if there must be multiple autoload functions, spl_autoload_register() allows for this. It effectively creates a queue of autoload functions, and runs through each of them in the order they are defined." When you include composers autoload.php, you eventually get a few calls to spl_autoload_register(), so simply register your custom autoloader after including composer's.
Upvotes: 2