Challenge 3 — Solution Task: Design (in comments/text, not necessarily runnable) a small project structure with namespace App\Models containing a User class and App\Services containing an EmailService class, following PSR-4 folder conventions. Write the index.php that would use both via Composer's autoloader, with no manual require_once for either class. ---- Project structure ---- my-app/ ├── app/ │ ├── Models/ │ │ └── User.php — namespace App\Models; class User │ └── Services/ │ └── EmailService.php — namespace App\Services; class EmailService ├── composer.json — maps "App\\" to "app/" ├── vendor/ — generated by Composer, not committed └── index.php ---- app/Models/User.php ---- email}...
"; } } ---- index.php ---- sendWelcomeEmail($user); ?> Expected output: Sending welcome email to alex@example.com... Notes: - Only ONE require appears anywhere in this project - vendor/ autoload.php at the top of index.php. Neither User.php nor EmailService.php is ever require_once'd manually, because Composer's generated autoloader locates both automatically the moment "new User(...)" or "new EmailService()" is first referenced. - EmailService.php itself uses "use App\Models\User;" to reference the User class inside its own method's type hint (sendWelcomeEmail(User $user)) - the same autoloading mechanism resolves this reference too, regardless of which file first triggers it. - The folder structure directly mirrors the namespace structure per PSR-4: App\Models\User lives at app/Models/User.php, and App\Services\EmailService lives at app/Services/EmailService.php - exactly the predictable mapping that lets Composer's autoloader work without being told about each class individually.