Composer autoloader
Not only does Composer handle dependency management, which is already no mean feat, it also provides us with a simple developer experience when writing code that uses our dependencies, or even our application code.
The problem that it solves is that it will automatically require the PHP files for any classes that are needed by any other classes. Loading PHP files on demand saves us a huge amount of boilerplate code and general pain. The term for automatically loading PHP files is known as "autoloading."
Old-fashioned versus autoloaded
To illustrate what autoloading is all about, let's have a look at some old-fashioned PHP code and compare it with some modern autoloader-based code.
First, let's define two classes that we will require/autoload.
First, we have two simple classes:
src/Part4/Chapter10/Dependencies/ClassOne.php
Repo: https://git.io/JRw5H
<?php declare(strict_types=1); namespace Book\Part4\Chapter10\Dependencies...