I wrote my framework. It has a few hardcoded things that make it what it is and then it has all these modules that it simply ingests. Now, I was thinking that it’d be exceptional if I could re-use some of these modules outside of my framework.
Even if they’re plug & play, you have to copy the folder to your new project and then make sure that module’s dependecies are met, because in your module, you might be relying on some other modules.
But there’s a huge, huge problem. What if, within the same space, say a website, two different sides of it require my RequiredPackage. How do I ensure that if the RequiredPackage is already installed, I don’t run into issues where I have to if( class_exists() ) on every single file?
So, in short, I’d like to be able to, in any folder’s composer.json specify that this part of the website requires ReduiredPackage but it shouldn’t run into “class already declared” issues.
Read more here:: How do I segment my code into re-usable composer packages in PHP?