We are trying to run a couple of sites sharing about 90% of their code. The business domain is the same, but their UIs are a bit different. Hence they will have different CSS.
How would you manage the codebase to share the code that requires it?
We are trying to run a couple of sites sharing about 90% of their code. The business domain is the same, but their UIs are a bit different. Hence they will have different CSS.
How would you manage the codebase to share the code that requires it?
Two general ways
For instance, all the application level code, such as router, dependency managing, validation, domain entities mapping can be managed as Composer dependencies through Packagist. It's possible to use private repos as dependencies if code is not open sourceable.
You would then have a different repo for each site, and make the parts which are the same be built using Composer, and only coding the part which is actually different. You'd probably have two servers, for different domains.
This implies more configuration through Composer and code.
repo 1 /app /viewSpecificToOne /public /cssSpecificToOne /jsSpecificToOne index.php /vendor /[dependencies installed through composer] repo 2 /app /viewSpecificToTwo /public /cssSpecificToTwo /jsSpecificToTwo index.php /vendor /[dependencies installed through composer]
This is close to the other solution, but you would send the different routes to different front Controllers, who would use the same domain mappers, validation, routers, etc. but have two different View layers, that would feature specific code.
This implies more configuration from the server to serve each domain from the two public repos.
Repo /app /view1 /viewLogicSpecificToOne /view2 /viewLogicSpecificToTwo /public1 /cssSpecificToOne /jsSpecificToOne index.php /public2 /cssSpecificToTwo /jsSpecificToTwo index.php /lib /sharedPackages