'App/Controller not found in REST API Project
This is pure php project
Here is my composer.json code , when i debug "CatalogController.php" file , it gives me following error . Please help me to resolve this incident
Folder Structure
CatalogController.php - https://prnt.sc/26jxjw9
<?php
namespace App;
use Exception;
use App\Controller;
use App\CatalogModel;
use App\JwtMiddleware;
use App\RequestMiddleware;
class CatalogController extends Controller {
......
}
composer.json
{
"require": {
"klein/klein": "^2.1",
"firebase/php-jwt": "^5.2"
},
"autoload": {
"psr-4": {
"App\": "App/"
},
"classmap": [
"App/Controller",
"App/Middleware",
"App/Model"
]
}
}
[+Updated]
Thanks my team. I resolved 90% . But i got this error. https://prnt.sc/26jzpxp
Please help me to resolve this incident.
Solution 1:[1]
- invalid namespace
Appor directory structure, read PSR-4 manualto understand how it use - redundant import
use App\*;inCatalogController.php- this classes inAppnamespace too - invalid JSON
"App\" - redundant
classmapsection incomposer.json- read Composer manual to understand how it use
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | WinterSilence |
