Tools, patterns and delivery

From a working script to a shipped application: command line tools, the SPL classes, OPcache, static analysis, refactoring, PSR-12, the strategy, factory, repository and observer patterns, hand tests, performance and deployment.

12.1 CLI applications argv input, exit codes, colours, and interactive prompts Open 12.2 SPL essentials SPL for files, stacks, queues, fixed arrays, and a simple autoloader Open 12.3 OPcache deep dive OPcache status, timestamp validation, preloading, and the CLI behaviour Open 12.4 Static analysis PHPStan levels, Psalm checks, baselines, and a CI gate Open 12.5 Refactoring extract method, careful renames, a duplication hunt, and retests Open 12.6 PSR-12 style file layout, spacing rules, and PHPCS enforcing PSR-12 Open 12.7 Strategy and factory strategy objects and small factories in place of messy conditionals Open 12.8 Repository and observer repositories, observers, and a tiny event dispatcher Open 12.9 Testing without frameworks hand asserts, table cases, and a red-green habit, no framework Open 12.10 Performance measure first, cache the result, enable OPcache, profile the hot path Open 12.11 Deploy PHP a calm checklist, env files, safe migrations, and a rollback plan Open

Lessons