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

Naming Conventions for controllers and models

I can't remember where, but I'm sure I saw something in the docs before related to naming conventions of modelos and controllers, especially around using the dev tools? Does anyone have a reference to this? E.g what should be a capital letter, and I'm sure I saw something about how to treat hypens - and underscores _ in urls.

Can anyone remember or point me to the rules?



98.9k

Phalcon does not force you to use a specific convention for controller and model names.

In a default configuration, if you pass my-controller-name or my_controller_name as controller it will try to find a controller called MyControllerNameController in a file called MyControllerNameController.php

Models are loaded exactly as they're invoked: $r = new Robots() loads a model called Robots in a file called Robots.php