In each example, we are going straight to the autoloader this way.
require_once __DIR__ . '/../vendor/autoload.php';
This is not working when things are installed via composer.
Add a check and try to find the real autoloader. If needed (since this is common, put this helper into a dedicated component.).
require_once __DIR__ . '/../../../autoload.php';