我正在使用Phalcon开发REST API。该应用程序将有多个模块,如用户,公司,联系人等。每个模块都有自己的表格用于存储数据。此外,每个模块都有自己的定义文件,其中提到了API响应中显示的字段。我对Phalcon非常陌生,我刚开始学习Phalcon,并且我需要关于如何构建应用程序的帮助,以便此代码不会给我未来的问题,或者如果我错过了某些内容或者代码可能被抽象化那么那会更好。Phalcon REST API结构
目录结构计划:
app/
MyAPI/
MyAPIControler.php
library/
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
/config
config.php
routes.php
index.php
我希望每个模块的所有数据库相关的查询驻留在自己的车型。 API URL说明列出的记录将为 http://api.example.com/MyAPI/V2/contacts/list或/ MyAPI/V2/users/list。同样,对于创建记录API URL将http://api.example.com/MyAPI/V2/contacts/add或/ MyAPI/V2 /用户/列表
请告知我应该如何进行