You can use a database ORM such as Eloquent to connect your SlimPHP application to a database.
Adding Eloquent to your application
Add the database settings to Slim’s settings array.
In your dependencies.php
or wherever you add your Service Factories:
Pass a controller an instance of your table
Query the table from a controller
Query the table with where
Query the table by id
Eloquent Documentation