How to create a PSR-4 autoloader for my project?
问题 I am creating a PHP project and want to implement PSR-4 autoloading. I don't know which files I need to create in the vendor directory to implement autoloading for class files. 回答1: If you are using composer , you do not create the autoloader but let composer do its job and create it for you. The only thing you need to do is create the appropriate configuration on composer.json and execute composer dump-autoload . E.g.: { "autoload": { "psr-4": {"App\\": "src/"} } } By doing the above, if you