Skip to content

mchojrin/GraphQL-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL-PHP

A POC for the integration of GraphQL and PHP

This project is the code accompanying this post. It's a simple Proof of Concept for the usage of GraphQL-PHP.

Dependencies

This project was tested on Linux and php8.1. It's designed to be run using docker

Running

The best way to see it in action is by leveraging docker-compose:

docker-compose up --build -d

Then, use any GraphQL client (Altair is recommended) and browse through the API documentation to run queries.

The endpoint will be found at http://localhost:54000

Example query

Once the server is up and running, you can use a query like this:

curl 'http://localhost:54000' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' --data-binary '{"query":"{User(id: \"bad31\") {name}}"}' --compressed

To get a response like:

{
  "data": {
    "User": {
      "name": "Peter"
    }
  }
}

About

A POC for the integration of GraphQL and PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published