Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Thanks for this. I'm already using nikic's Fast Route as my router. This is an interesting solution and definitely one to keep in mind. However, I would worry that it is going to lead to duplicated code, and potentially too much divergence between the two systems for this particular application, and consistency between the methods of access is going to be key. One thing you do remind me of though is the need to implement some kind of API version check.
Call your class (which doesn't look like a controller anymore...), then, output it to your HTML or JSON renderer, based on the check. You can do this in a class (or 2 - look up ADR - https://github.com/pmjones/adr-example) or in the router.