Loading only specific dependencies in PHP with Composer
Get the solution ↓↓↓Solution:
Obviously, the example here would save me fractions of seconds, and fractions of RAM
It actually does not save you nothing. Composer's autoloader loads class only when you request it. If you never use Twig or PHPMailer in your frontend request, it will never load it, so no RAM or CPU will be used.
Basically it already works in a way you would like to.
Answer
Solution:
I think that you can reconsider the structure of your application. In case that you have 2 independent parts, they can be split into 2 php apps with they own composer.json. Common code can be loaded as a dependency.
Anyway, having unused dependencies is not a big issue and it has almost zero impact on performance. So, technically, the goal you want to achieve is more about purity of the code, not the performance optimisation.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: an exception occurred in the driver: could not find driver
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.