Namespaces and Composer

Namespaces, Autoloading and Composer

Real applications spread code over hundreds of files and dozens of libraries. Namespaces keep their names apart, autoloading finds a class's file on first use, and Composer 5,243 installs libraries, pins their versions and writes the autoloader. This section turns the bookshop's Money into a real package, acme/shop-money, from bare require statements to Packagist 4,624 , with Composer 2.10.3 (27 August 2026). Laravel 2,157 (Laravel) is a Composer project throughout.

Subsections