Backend development

Stage 1 · Lesson 5 of 10

Composer and autoloading

Your language and how HTTP works

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

  • VideoFree
    PHP For Beginners

    Laracasts · Beginner

    Free video series that builds a small app in plain PHP before any framework

  • GuideFree
    PHP: The Right Way

    Josh Lockhart and contributors · Intermediate

    Modern PHP practice in one place: Composer, PSR standards, PDO and security basics

Practise

  • Your language track: small exercises with free mentor feedback on idiomatic code

Keep handy

  • Quick syntax lookups for your language when you forget how something is written

  • Read the HTTP overview, methods, headers and status code pages until they feel obvious

Also worth your time

Mark this stage as not done?