Skip to content

Advanced PHP Tutorials

This tier takes the Intermediate tier's persisted JSON API and hardens it for real deployment — moving off php -S (which is explicitly not meant for production) onto a production-grade stack.

What You'll Build

JWT auth on POST /items, SQLite-backed per-IP rate limiting, php-fpm + nginx replacing php -S, a multistage Docker build, an HTTP-level integration test suite, consolidated env-based config, and a GitHub Actions CI/CD workflow.

Learning Path

#TutorialConcepts
01Why Production HardeningWhat's missing, and why PHP skips graceful shutdown/pprof
02JWT Authfirebase/php-jwt, bearer tokens, minimum key length
03Rate LimitingFixed-window, SQLite-backed (shared-nothing means no in-process counter)
04php-fpm and NginxFastCGI, pool config, the Authorization header gotcha
05DockerMultistage build, sqlite-dev, docker-compose
06Integration TestsReal php -S subprocess, curl extension
07Config and SecretsOne config(), secrets per environment
08CI/CD GitHub ActionsLint, test, build, push to GHCR

Prerequisites

  • Completed Intermediate tier
  • Comfortable with the persisted JSON API from that tier
  • Docker installed (docker --version)

Start with 01 Why Production Hardening.