# MindVisionCode PHP

A small PHP MVC framework inspired by a Classic ASP MVC framework.

## Run

```bash
composer install
php scripts/migrate.php up
php -S localhost:8000 -t public
```

Open:

```text
http://localhost:8000
```

Try:

```text
http://localhost:8000/users/123
```

Employee form:

```text
http://localhost:8000/employees
```

## Request Flow

Browser → public/index.php → Request → Dispatcher → Router → Route → Controller → ViewModel/Repository → View → Response

## Main Folders

- `core/` framework classes
- `app/Controllers/` application controllers
- `app/ViewModels/` view model classes
- `app/Repositories/` data access classes
- `app/Views/` PHP templates
- `routes/web.php` route definitions
- `database/migrations/` migrations
- `scripts/` runnable PHP CLI scripts

## SQLite

The default database is SQLite and points to:

```text
database/app.sqlite
```

The database file is created automatically when the app first needs it.

Run migrations from the PHP CLI:

```bash
php scripts/migrate.php up
php scripts/migrate.php down
php scripts/migrate.php status
php scripts/migrate.php make create_projects_table
php scripts/migrate.php fresh
php scripts/migrate.php fresh --seed
php scripts/seed_employees.php 1000
```

## Frontend Libraries

The employee directory page uses:

- `htmx` for fragment-based form and summary updates
- `Alpine.js` for lightweight page state
- `Tabulator` for the interactive employee table

## Flow chart

See [`REQUEST_FLOW.md`](./REQUEST_FLOW.md) for a chart of how requests and responses move through the framework.
