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

Doubts with Micro Applications (RESTFUL SERVICE)

Hello Folks,

I saw this tutorial : https://docs.phalcon.io/en/latest/reference/tutorial-rest.html

I have some questions about micro applications with phalcon. i am creating a android app that needs a restful service , and i really really need a great performance.

1) Wheres the atributtes (name,type and year) of robot model in this tutorial ?

2) can i create a restfull with model and controller ? Or this architeture in the tutorial is recommended for rest service ? Will i lose some performance if i choose to use mode and controller ?

3) has phalcon a RESTful API Authentication Schemes ?

Sorry for my bad english , Thanks so much !!



6.9k
Accepted
answer
  1. Phalcon models don't need attributes. Phalcon reads the description of the table from the database. The benefit of adding attributes to the model is primarily for auto completion/highlighting in your IDE

  2. You can use controllers if you like. Phalcon DI is more like a glue. You aren't bottled into a full application DI with views if you don't want to. Neither are you limited to a micro DI. Check out how this author structured his application and adopt your own architecture for what suits your project: https://github.com/cmoore4/phalcon-rest

  3. There are some third party plugins. It depends what type of authentication scheme you are interested in.


2.5k

Thanks so much dude !! do you recommend to use PHQL or the methods from model , like save() , findFirstById() etc. ?

I would use the methods Phalcon has already defined as much as possible. Unless you have a specific reason to use PHQL (like stored procedures), let the framework do the work.



2.5k

thanks firemyst1371!!!