https://github.com/basemax/firstphpgraphql
Create a GraphQL server (restful) web service using PHP.
https://github.com/basemax/firstphpgraphql
graphql graphql-api graphql-client graphql-php graphql-schema graphql-server json php php-graphql php-graphql-clinet php-graphql-payload
Last synced: about 2 months ago
JSON representation
Create a GraphQL server (restful) web service using PHP.
- Host: GitHub
- URL: https://github.com/basemax/firstphpgraphql
- Owner: BaseMax
- License: gpl-3.0
- Created: 2021-06-14T08:28:02.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-15T10:37:26.000Z (about 4 years ago)
- Last Synced: 2024-11-12T11:02:54.080Z (8 months ago)
- Topics: graphql, graphql-api, graphql-client, graphql-php, graphql-schema, graphql-server, json, php, php-graphql, php-graphql-clinet, php-graphql-payload
- Language: PHP
- Homepage:
- Size: 156 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# First PHP GraphQL (Web-service)
GraphQL is a new generation of web services, it's best to maintain a big webservice for multi-platform and projects; In this repository, we design a full-feature **graphql server** using **PHP**.
## GraphQL Shema
```graphql
type Query {
echo(message: String!): String!
sum(x: Int!, y: Int!): Int!
}
```## Using
Install **composer** and installing required packages:
```
sudo apt install composer
composer install
``````
php -S localhost:8080 ./graphql.php
```Open `http://localhost:8080/` at your browser and use.
## Example
#### Input
```graphql
{
echo(message: "Hello World")
sum(x: 2 y:10)
s2:sum(x: 2 y:1)
s3:sum(x: 2 y:60)
s4:sum(x: 2 y:50)
s5:sum(x: 2 y:100)
}
```#### Output
```json
{
"data": {
"echo": "Welcome, Dear Hello World",
"sum": 12,
"s2": 3,
"s3": 62,
"s4": 52,
"s5": 102
}
}
```## GraphQL Playground
Installing at arch: `yay graphql-playground-electron`

© Copyright Max Base, 2021