mevdschee / php-crud-api

Single file PHP script that adds a REST API to a SQL database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any advice on events integration?

apps-caraga opened this issue · comments

I'm just wondering what is the best way to integrate events into this library. Should it be integrated as a controller or as a middleware or some other way? I think events would be a good feature to have as it would enable us to hand off some async tasks such as emailing, generating pdfs, etc to other APIs or services.

Good question. I would integrate on the database. Create a record for an event (outgoing email) and let a cron job send it and update the "sent" column using the API.

Thanks for the quick response. Sometimes I forget about cron for background/async tasks. Anyway, I'll stop overcomplicating things with integrating 3rd party event libraries. 😁