
Multi-Site Architecture with a Shared PHP Codebase
Running multiple sites from a single codebase sounds like a maintenance nightmare, but with the right architecture it can be remarkably efficient. I run 4 production video discovery sites from the same PHP codebase, each targeting different geographic regions. Here's how the architecture works at DailyWatch . The Problem I wanted to target different video markets (US/Europe, Asia, etc.) with separate sites for SEO and branding purposes, but I didn't want to maintain 4 separate codebases. The Solution: Config-Driven Differentiation The codebase is identical across all sites. Differences are controlled entirely by per-site configuration files: // .env file - unique per site, excluded from deployment SITE_NAME = DailyWatch SITE_URL = https :// dailywatch . video SITE_TAGLINE = Your daily dose of trending videos # Regions to fetch (unique per site) FETCH_REGIONS = US , GB , DE , FR , IN , BR , AU , CA FIXED_REGIONS = US , GB # Cron frequency FETCH_INTERVAL = 7200 # Database (local per site
Continue reading on Dev.to Webdev
Opens in a new tab


