Member-only story
GraphQL Tutorial: How to Build an App in PHP
Originally published at www.scalablepath.com by Bruno.
Have you heard about GraphQL? Facebook open-sourced it in 2015 and I believe it is a much better way to establish contracts between a client and a server than REST. If, like me, you are always searching for the easiest way to develop and maintain code, this GraphQL Tutorial is for you.
In this article we will:
- Give a brief introduction to GraphQL
- Show the improvements of GraphQL over REST
- Show you, step by step, how to add a feature to a GraphQL app written in PHP
It’s worth noting that both the code and the application we are going to explore are open source, so you can use it as a foundation for your own work. With such new technologies, ‘best practices’ are constantly evolving. As a result, I have thoroughly researched and refactored all code used in this article and hope it can serve as example code to get you started on your GraphQL journey.
Note: I use the term ‘information’ and ‘informations’ throughout this article to describe, respectively, the singular and plural of an object. This stems from the article originally being written in Portuguese, where it makes sense to use the plural for the word ‘information’.
HOW I ENDED UP TESTING GRAPHQL
I have been using React as my frontend for a while and was mostly happy with its performance. My apps became a…