# 0001. Yii 2 basic template as foundation

- **Status:** Accepted
- **Date:** 2025-06-28

## Context

A self-storage business needed a public site, a customer account area and a back office in one system. The
developer had a working Yii 2 codebase from an earlier project of the same shape, with its own `ActiveRecord`
base, widget layer and declarative admin module already built.

## Decision

Build on the **Yii 2 basic application template**, PHP 8.3, PSR-4 root namespace `app\` mapped to the
repository root, keeping the framework's own directory layout and adding `services/`, `widgets/`, `helpers/`,
`db/`, `base/` and `modules/admin/`.

## Alternatives

- **The Yii 2 advanced template** — separate `frontend`/`backend`/`console` applications. Rejected: the
  admin is a module here, and the split would have duplicated configuration for no benefit at this size.
- **Symfony or Laravel** — no reuse of the existing base classes, and a rewrite of the admin module, which is
  the single largest asset carried over.
- **A headless API plus a JS frontend** — far more surface for a site whose pages are mostly server-rendered
  content.

## Consequences

- Everything the framework does not provide — schema declaration, the widget layer, the admin CRUD framework —
  is ours to maintain. That is roughly a third of the codebase.
- The sibling **Molino** project shares the same foundation, so patterns transfer between them.
  They have since diverged; see [0002](0002-single-brand-deployment.md).
- `yii2-swiftmailer` and `yii2-bootstrap4` are pinned to versions the framework still supports; upgrading past
  them is a separate piece of work.
