Skip to content

taisreis67/web-php-bff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A BFF using GraphQL and PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages