Stage 1 · Lesson 5 of 10
Composer and autoloading
is PHP's package manager. composer.json lists the packages you want from Packagist, the public package store, plus your autoload rules. composer.lock pins the exact versions, and composer install reproduces them anywhere.
Autoloading is the part to understand properly: PHP finds and loads a class file the first time you use the class, with no require lines. A PSR-4 rule makes this work by mapping a to a folder. Map the App\ namespace to src/, and the class App\Orders\OrderService lives in src/Orders/OrderService.php.
Namespaces and use statements follow the same structure, and depends on all of it.
Common traprunning composer update on a server, or committing without composer.lock, which installs different versions from the ones you tested.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- VideoFreePHP For Beginners
Laracasts · Beginner
Free video series that builds a small app in plain PHP before any framework
- GuideFreePHP: The Right Way
Josh Lockhart and contributors · Intermediate
Modern PHP practice in one place: Composer, PSR standards, PDO and security basics
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle