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

Just working on API System built on Phalcon's Module Structure

Having a good time with Phalcon creating APIs still. Have module checking api keys, creating list of available modules, including available event notifications and hooks, checks user sessions on CRUD functions. Does all these processes and still returns data quickly. My entire goal was to feel I built a custom API system, which is a bit harder to accomplish using pre-defined frameworks that aren't as fleixble as Phalcon. Example responses from address table, i have run against 20,000 articles and still great speed.

No Cache

{
    "status": "200",
    "response": "OK",
    "message": "48 Record(s) Found.",
   "records": {
        "per_page": 20,
        "current": 1,
        "first": 1,
        "before": 1,
        "next": 2,
        "last": 3,
        "total_pages": 3,
        "total_items": 48
    },
    "meta": {
        "method": "GET",
        "module": "address",
        "controller": "index",
        "action": "index",
        "responseTime": "0.0158 seconds",
        "memoryUsage": "0.93 mb"
    }
}

Cache response

{
    "status": "200",
    "response": "OK",
    "message": "Records Found from Cache.",
 "records": {
        "per_page": 20,
        "current": 1,
        "first": 1,
        "before": 1,
        "next": 2,
        "last": 3,
        "total_pages": 3,
        "total_items": 48
    },
    "meta": {
        "method": "GET",
        "module": "address",
        "controller": "index",
        "action": "index",
        "responseTime": "0.0071 seconds",
        "memoryUsage": "0.79 mb"
    }
}


43.9k

Hi,

well, thank you for sharing this, but imho it could be more usefull if:

  • we know on what kind of server configuration your app is running on
  • and what's the database query that has been done in your indexAction to fetch 48 items from a dataset of 20 000

Howdy,

Been working on releasing it.. https://github.com/trentramseyer/ThingEngine

the 48 items were from the address table with 48 items. The 20,000 record set was a test I did with different data