I have a simple PHP web app with the following structure:
/ (composer.json .htaccess ...)
/Core/ (Router.php, Controller.php ...)
/App/ (/Controllers, /Models, /Views ...)
/Public/ (index.php ...)
/Vendor/ (autoload.php /composer ...)
The codes runs without issue on my local server.
When I copy it to a live server and make the necessary changes to .htaccess in route I get the following error: Fatal error: Class 'Core\Router' not found in.... I have tried 3 different hosts but no luck.
The issue seems to be to do with the composer autoload function not loading in the namespaces and classes using psr-4. I have this set up in my composer.json file:
{
"autoload": {
"psr-4": {
"Core\\": "Core/",
"App\\": "App/"
}
}
The code for my project is on GitHub at
https://github.com/imoprojects/upbook
I am new to programming in an MVC structure and also with using composer in this way.
If anyone could assist with what maybe happening, I would really appreciate it.
Cheers, Ian
You configure this:
"Core\\": "Core/",
... but your classes are at:
core
This will only work in case insensitive file systems.