PHP and autoloading · Question 7 of 12

Which file does a PHP script include to use the autoloader generated by Composer?

1 answer is correct. Easy

Show answer

Answer

  • B vendor/autoload.php

Explanation

Composer writes the file vendor/autoload.php during composer install, composer update and composer dump-autoload. A custom script only needs require __DIR__ . '/vendor/autoload.php';, after which all classes of the installed packages are available. In a TYPO3 Composer installation the entry point already takes care of this, which is why you never see the line in extensions. composer.json and composer.lock, in contrast, are description files for Composer itself and contain no executable PHP code.

Certifications & exams

Which exam comes next?

You can already practise for 19 exams, and 21 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications