https://odan.github.io/2019/11/05/slim4-tutorial.html
If you liked the tutorial, please click here on the star button: https://github.com/odan/slim4-tutorial
For technical questions create an issue here: https://github.com/odan/slim4-tutorial/issues
If you have Slim framework specific questions use: https://discourse.slimframework.com/
Write your comments / suggestions / feedback here 👇
Hi @odan ! fantastic tutorial . I am following it right now, but i customized it as per my requirement and didn't worked so far. If i start my local server with
php -S 0.0.0.0:8080 -t public public/index.phpit works like a charm. but on real server i cannot start the server explicitly for this project as there are other php project running. so i had to add$app->setBasePath('/somefolder/slim4')here in
container.phpif i add these lines it wont work like thisi am again adding / creating the instance here in
routes.php// also notice i have removedreturn function(App $app){//this is not working$app = AppFactory::create();$app->setBasePath('/somefolder/slim4'); //now it works$app->get('/', \App\Action\HomeAction::class)->setName('home');and in
bootstrap.phpi changed it to// Register routes (require __DIR__ . '/routes.php');//($app);//notice i removed$appfrom passing as we have removedreturn function(App $app){fromrouter.phpbut i can see its a bad way to fix this issue, any other way or am i missing something. how to fix this
Thanks in advance