TQ
dev.com

Blog about software development

Subscribe

PostgREST for MySQL in PHP

21 Mar 2016 - by 'Maurits van der Schee'

Today I stumbled upon "PostgREST", a generated PostgreSQL REST API. I have built PHP-CRUD-API, a similar tool, for MySQL in PHP.

PostgREST is a standalone web server that turns your database directly into a RESTful API. The structural constraints and permissions in the database determine the API endpoints and operations.

This great software is written by Joe Nelson and has acquired over 6000 stars on Github and has it's own website on postgrest.com.

Compared to PHP-CRUD-API

Below are a few things that PostgREST does different than PHP-CRUD-API:

Compared to PHP-CRUD-API PostgREST is much more full-featured:

I'm not sure all of the above are nessecary features, but it is clear that there is still a lot of work to do on PHP-CRUD-API. I tried to pick 3 things that seemed like a particular good idea and that I did not implement yet:

  1. Support JSON Web Tokens
  2. Support column filters on relations
  3. Support "upserts"

I will add these 3 things on my to-do list and you can expect them to be added in the near future.

(Edit 2016-04-05: Implemented "column filters on relations")

Other reflective APIs

In order to find out what I am missing I investigated some other reflective APIs.

Note that JSON server is more suited for prototyping, while DreamFactory is really full-featured and LoopBack is better for high performance APIs.

Further reading


PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.