Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso:
Foreign Data Wrappers with PostgreSQL and PHP
Feb 22, 2016 @ 15:43:48

Gonzalo Ayuso has posted a quick tutorial to his site showing you how to work with Foreign Data Wrappers on your PostgreSQL database in PHP. If you're not familiar with the data wrappers functionality, you can find out more on the PostgreSQL wiki.

PostgreSQL is more than a relational database. It has many cool features. Today we’re going to play with Foreign Data Wrappers (FDW). The idea is crate a virtual table from an external datasource and use it like we use a traditional table.

He gives an example of a simple RESTful service with a Silex application serving up a set of user data (names). He then switches over to the PostgreSQL side and shows how to create the data wrapper and set up the mapping of it to the REST server's location. With that set up you can then select from the data returned as if it were a normal table with a slight caveat - filtering (like with where) must be done server side, not via the SQL statement.

tagged: postgresql tutorial foreigndatawrapper datawrapper database rest service

Link: http://gonzalo123.com/2016/02/22/foreign-data-wrappers-with-postgresql-and-php/


Trending Topics: