Beginner PHP Tutorials
Build a small JSON HTTP API on PHP's built-in server, step by step. Each tutorial adds a new concept while extending the running artifact.
Learning Path
| # | Tutorial | Concepts |
|---|---|---|
| 01 | Install PHP | Toolchain setup, php -v, php -S |
| 02 | Hello World | Basic syntax, <?php, echo |
| 03 | Variables and Types | Scalar types, === vs ==, type coercion |
| 04 | Control Flow | if, loops, match |
| 05 | Functions | Typed params, defaults, named args, arrow functions |
| 06 | Arrays | Indexed vs associative, array_map/filter/reduce |
| 07 | Classes | Constructor promotion, methods, readonly |
| 08 | Hello HTTP | php -S router scripts, $_SERVER |
| 09 | JSON Encoding | json_encode/json_decode |
| 10 | Serving JSON | The full JSON API artifact — GET /items, GET /items/{id} |
Prerequisites
- PHP installed
- Basic programming knowledge (variables, loops, functions)
Start with 01 Install PHP.