GithubHelp home page GithubHelp logo

basemax / firstphpgraphql Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 160 KB

Create a GraphQL server (restful) web service using PHP.

License: GNU General Public License v3.0

PHP 100.00%
php graphql graphql-server graphql-client graphql-api graphql-schema graphql-php php-graphql php-graphql-payload php-graphql-clinet json

firstphpgraphql's Introduction

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

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

{
  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

{
  "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

firstphpgraphql's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.