Can we connect to database in Grav?

I am just searching for how we can connect with database if we want to integrate some third party API and need to store data in database

You can do anything you want with a Plugin. Use MySQL, MongoDB or any other database, also some file-based database like https://github.com/fire015/flintstone or https://github.com/jamesmoss/flywheel.

+1 for a database connection plugin. I’d love to be able to to connect to a PostGreSQL database. Seems like Plugin Recipes would be the place to start.

This is definitely already on our list of things to investigate as part of plans to improve large-scale performance, but will have other uses too.

I have removed php| from the .htaccess security block line 59 starting with RewriteRule ^(user). Not sure why this has to be there. I have created a subfolder in user/assets/php where scripts are located for making a database call via ajax.