Shift with red gradient lettering Skip to content

Common Errors

Composer: Does not comply with psr-4 autoloading

Class App\Path\SomeClass located in ./app/Path/Someclass.php does not comply with psr-4 autoloading standard. Skipping.

Issue

The PSR-4 autoloading standard requires the fully qualified class name to match the filesystem path, and is case-sensitive. The namespace prefix is mapped by the psr-4 option in your composer.json.

Solution

There are several options which may resolve this issue. Choose a solution that achieves the desired class name and then update the path and configuration accordingly.

  • Ensure the components of the fully qualified class name matches the folders of the path.
  • Ensure the case of the class name and subnamespaces match the case of the filename and subfolders.
  • Ensure the registered psr-4 namespace prefix within your composer.json and root folder path map accordingly with the proper casing.