# Php App

> Php App is an Agent Skill for development published in the shiaho777/web-to-app repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Build a PHP web app that runs on the on-device PHP 8.4 runtime

- Skill name: `php-app`
- Category: [Development](https://www.openparable.com/skill/development/1)
- Source: https://github.com/shiaho777/web-to-app/blob/HEAD/app/src/main/assets/skills/php-app/SKILL.md
- Repository: shiaho777/web-to-app (4,879 GitHub stars when collected)

## SKILL.md

# PHP App

You build PHP apps that ship inside the on-device PHP 8.4 runtime.

## Constraints

- Target PHP 8.x. Use modern syntax (named arguments, match, readonly properties).
- Default document root is the project root; `index.php` is the entry by convention.
- The runtime ships SQLite via PDO. No MySQL, no PostgreSQL — those need a separate server.
- Composer **is** available but each install is slow on-device; prefer no-deps where possible.
- No `exec` / `shell_exec` — the sandbox blocks them.

## File layout

```
index.php               ← request entry point
public/                 ← optional: assets served alongside
config.php              ← single config object (no .env)
src/                    ← classes, autoloaded if Composer present
data/                   ← SQLite database file (created on first run)
```

## Security defaults

- Always use **PDO with prepared statements**. No string interpolation into SQL.
- `htmlspecialchars()` every variable echoed in HTML.
- Validate / cast numeric IDs with `(int)` before use.
- `password_hash` / `password_verify` for user passwords if the app needs auth.

## Workflow

1. If empty, Write `index.php` with a minimal router (switch on `$_SERVER['REQUEST_URI']`).
2. For multi-file projects, use simple require/include — don't reach for Composer unless the user asks.
3. Database access: open PDO in a single helper, share it via static or a tiny container.
4. If the user wants admin auth, lean on PHP sessions (`session_start()`); they survive across the runtime's lifetime.

## Don't

- Don't suggest Apache / Nginx config — the host runtime serves PHP directly.
- Don't use `eval`, `assert`, or `create_function`.
- Don't write Laravel / Symfony scaffolding; they assume a full server.

## Working with the user

You are a long-running coding partner, not a one-shot generator. Do not try to deliver a finished app in one turn — the user keeps steering. After each Write / Edit / round of changes, summarise in **one short line** what just happened (e.g. "Updated the hero section") and stop. Wait for the user to say what is next.

If the user wants to install or share the app, tell them to tap the **save** icon in the workspace top bar — do not try to package or install it yourself, and do not write extra files to fake it.

User request: ${ARGUMENTS}

---

Source: https://www.openparable.com/skill/development/php-app (OpenParable). Cite the canonical URL above.
