Hello, I’m just getting started with Applications Development, and a close friend of mine told me about Slim, as a fast and easy way to provide my database with a working API. After doing all that’s supposed to do, when I try to log into my database via phpMyAdmin (my database is still in local), it shows this error message:
Fatal error: Trait ‘Slim\MiddlewareAwareTrait’ not found in /Applications/XAMPP/xamppfiles/htdocs/Slim/App.php on line 50
After searching for a while, I read that someone advised another person with my same trouble to install composer in the project, and so I did. But this error still stands for me.
I know there might be some information missing here, and sorry for that, but I’m new with all of this, and still don’t know what more do I need to say about this. Please help me!
Hi @miiko23, if this is your first time using Slim 3, I would recommend going through the walkthrough tutorial first http://www.slimframework.com/docs/tutorial/first-app.html. This will give you a better understanding of Slim 3 and get you started in the right direction.
Hi! I’ve been looking around the url you posted, and I found nothing about the error it shows to me. As I read the error, I supposed there must be something wrong, because it says the system is unable to find the MiddlewareAwareTrait.php file, but I’ve been diving around the folders, and I found it. What may be happening?
It’s hard to tell without some code, but it looks like the composer autoloader is not loaded. You may be missing this line:
Have you tried the minimal example at http://www.slimframework.com/docs/tutorial/first-app.html#create-the-application?
I am going to suggest again going through that tutorial to get a better understanding of how Slim 3 works and how to install it. I will outline what you may have done wrong but you are better off following the tutorial I linked.
You might have cloned the Slim repo from Github, this was the default way of working with Slim 2, but no longer the case when working with Slim 3.
You don’t have an actual autoloader in the correct place in your project because you are trying to setup from the cloned repo.
If you need to start a project with Slim 3, then clone the slim-skeleton repo and follow the steps shown in the README and that should get you going.
Please take a look at the tutorial I liked as this will make it easier for you to progress with what you want to build with Slim 3.
You get that error while trying to access phpmyadmin?
Do you have phpmyadmin installed in the same folder as Slim? That would mean the Slim
.htaccess would pull all traffic to itself and the phpmyadmin folder would not be accessible.