customizing where composer autoloader pulls from at runtime? #11937
Unanswered
dadamssg
asked this question in
Q&A / Support
Replies: 1 comment 1 reply
-
you could create your own custom instance of the ClassLoader (you can reuse the implementation of the Composer ClassLoader instead of creating your own). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let me preface by saying i'm working with a very old php project that does not use composer's autoloader. I'm trying to work out how I can load classes from different directories based on the requested subdomain. The app responds to multiple subdomains.
For example, let's say i have this structure:
If a request comes in from the acme subdomain,
https://acme.domain.com/api/users/1
then the following files should be autoloaded:The namespace will be the same in both
src/User/User.php
andsubdomain/acme/User/User.php
:And this will be in
composer.json
:Do i just need to define my own psr-4 autoloader that checks for custom code and register that before composer's? or is there a way to hook into composer's somehow?
Beta Was this translation helpful? Give feedback.
All reactions