I am developing REST API using Phalcon. The application will have multiple modules like Users, Company, Contacts and so on. Each of these modules have their own tables for storing data. Moreover each module have their own defination file which mentions what fields to show in API response. I am pretty new to Phalcon, i just started learning, and I need help regarding how i should structure the application so that this code won't give me future problems, or if I'm missing something or if the code could be abstracted more then that would be great.
Directory Structure as planned:
controller.php //master controller where all controllers inherit from model.php //master model where all models inherit from utilities.php MyAPI/ models/ User.php Contacts.php Company.php Myapi.php
I want all database related queries of each module to reside in their own models. API URL say for listing of records will be http://api.example.com/MyAPI/V2/contacts/list or /MyAPI/V2/users/list. Similarly API URL for creating records will be http://api.example.com/MyAPI/V2/contacts/add or /MyAPI/V2/users/list
Please advise how i should proceed.