We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Barebones MongoDB example project/template?

Hello guys! First post here so I hope I dont mess it up...

I want to use MongoDB with Phalcon.

The problem is that I can not "glue" both things together.

Using MongoDB on its own is fine and I know how to display results with plain PHP.

But the controller part and architecture of the Phalcon Framework scares me a bit and confuses me since I do not really understand it yet, even after reading the first parts of the documentation. The Web also didnt offer much help regarding simple and easy to understand MongoDB/Phalcon projects.

I really want to use Phalcon but I dont know how my base code has to look where I can simply connect to my local mongo database and display the results using the Phalcon framework.

I read this tutorial: https://docs.phalcon.io/fr/latest/reference/odm.html but most of the descriptions are too abstract to me and I dont know how to put these things together shown in the tutorial.

So is this tutorial available (with the respective database) as a downloadable project so that I can use this barebone project as a starting point or something similar?

Please help me :(



43.9k

Hi,

have a look at Dasshy, on Phalcon's github. It is a micro App, without the full MVC stack.

So routes and most of the logic is in handlers.php:https://github.com/phalcon/dasshy/blob/master/app/handlers.php

also services.php for MongoDb initialization: https://github.com/phalcon/dasshy/blob/master/app/config/services.php

and model Visits.php : https://github.com/phalcon/dasshy/blob/master/app/models/Visits.php



1.8k

Thank you so much - I will look into it!

Hi,

have a look at Dasshy, on Phalcon's github. It is a micro App, without the full MVC stack.

So routes and most of the logic is in handlers.php:https://github.com/phalcon/dasshy/blob/master/app/handlers.php

also services.php for MongoDb initialization: https://github.com/phalcon/dasshy/blob/master/app/config/services.php

and model Visits.php : https://github.com/phalcon/dasshy/blob/master/app/models/Visits.php