Skip to content

Latest commit

 

History

History
45 lines (27 loc) · 1.53 KB

README.md

File metadata and controls

45 lines (27 loc) · 1.53 KB

Web PHP BFF

A backend-for-frontend application used to demonstrate how to build it using PHP and GraphQL.

Requirements

You will need the following things correctly installed on your computer.

Installation

  • Clone the repository: git clone https://github.com/taisreis67/web-php-bff.git
  • Join inside repo: cd web-php-bff
  • Install project dependencies: composer install

Run application

  • php -S localhost:8000 src/graphql.php

How make requests

curl 'http://localhost:8000' -H 'Content-Type: application/json' -H 'Accept: application/json' --data-binary '{"query":"{movie(id: 550) { title, productionCompany { homepage }}}"}' | json_pp

How to test

You could test and see the results using GraphiQL Chrome Extension

API

The BFF is consuming a public API called TMDB (The Movie Database API) 3v.

To use it you need create an account at TMDB and generate an API Key. After that you need put your API Key in the url that call the API, example:

$url = 'https://api.themoviedb.org/3/movie/popular?api_key=your-api-key';

Further reading

  • BFF about BFF
  • GraphQL query language used in BFF