Hello there,
I’m reaching out regarding an issue I encountered after successfully deploying my application using PHP 8.2 on Google App Engine. It seems that my application is unable to locate any auto-loaded classes. Previously, I managed to meet PSR-4 Autoloading standards by specifying the workspace folder in the composer.json file. However, even with this setup, the issue persists.
Would you have any insights or suggestions on how I can resolve this matter within the Google App Engine environment?
Thank you in advance for your assistance.
composer.json:

Classes folder in root folder:

Namespace declaration in Sanitizer.php:

Use statement & Class/Method called in Index.php:

Error found in Google Logger:

1 Like
Hi @chikondi ,
Welcome to Google Cloud Community!
Mismatch between composer.json configuration and class location/naming.
Solutions:
- Verify Path: Ensure Sanitizer.php resides in the directory specified by composer.json (e.g., workspace/classes/).
- Check Case Sensitivity: Match the casing in composer.json (Abre//) to the actual class name (Abre\Sanitizer).
- Clear Autoload Cache (if needed): Run composer dump-autoload to refresh the autoloader.
Code Fix (depending on the cause):
- Path Mismatch: Update composer.json path accordingly (e.g., remove trailing slash if Sanitizer.php is in workspace/).
- Case Mismatch: Fix casing inconsistency in either composer.json or the class name.
Additional Tips:
- Include require_once ‘vendor/autoload.php’; at the beginning of relevant scripts.
- Consider using relative paths within Sanitizer.php for dependencies (optional).