Basic questions about FF

55 views
Skip to first unread message

Ben

unread,
Feb 6, 2017, 6:54:58 PM2/6/17
to Fat-Free Framework
Hello,
I have some basic questions concerning this interesting framework:

- Can it be used as an API to return responses in JSON format ?
- How slower is it to use the built in template engine, instead of PHP templates ?

ved

unread,
Feb 6, 2017, 8:34:37 PM2/6/17
to Fat-Free Framework
Hello,

Hi there!
 
- Can it be used as an API to return responses in JSON format ?

Sure can! See ReST routing info here and a xml template example here (You can use the same method for json by changing the mime type if you really want to go the template route for json)
 
- How slower is it to use the built in template engine, instead of PHP templates ?

Probably a few microseconds slower as expected for each new layer of abstraction.

Also, if you're just outputting json, you can always just do something like this from your controller or afterroute:

header('Content-Type: application/json');
echo json_encode
($myapidata);

And skip templating entirely.

Summer White

unread,
Feb 10, 2017, 3:05:38 AM2/10/17
to Fat-Free Framework
I hate seeing these questions "How slower is it..."

Performance should be an after thought until the project actually gets done. Especially with a framework like F3 that is already crazy fast.

Sascha

unread,
Feb 10, 2017, 3:57:58 AM2/10/17
to Summer White via Fat-Free Framework
Since F3 is converting its own templates to pure PHP templates, you won’t feel any difference in my opinion. If you care about database related benchmarks though check out 



--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/9441e66e-5fc1-4fdd-ae3a-e5678c5a9be7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages