Intermediate PHP Tutorials
This tier extends the Beginner tier's JSON HTTP API with a persistence layer — the API stops holding data in memory and starts reading and writing real storage.
What You'll Build
GET /items, GET /items/{id}, and POST /items reading and writing an items.db SQLite file via PDO, a store layer separating SQL from routing, config via an environment variable, and a PHPUnit test suite. No framework.
Learning Path
| # | Tutorial | Concepts |
|---|---|---|
| 01 | Why Persistence | What the beginner endpoint can't do |
| 02 | Project Setup | pdo_sqlite extension, require |
| 03 | Schema | PDO, DSNs, ERRMODE_EXCEPTION |
| 04 | Store Layer | ItemStore class, prepared statements |
| 05 | List and Get Handlers | Testable handler shape, parse_url |
| 06 | Create Handler | php://input, null coalescing validation |
| 07 | Config | getenv, SQLite → MySQL via DSN |
| 08 | Tests | Composer, PHPUnit, in-memory SQLite |
Prerequisites
- Completed Beginner tier
- Comfortable with PHP arrays, functions, and the built-in server
Start with 01 Why Persistence.