Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mobiosolutions/graphql-with-laravel
How to Implement GraphQl server with Laravel.
https://github.com/mobiosolutions/graphql-with-laravel
graphql laravel laravel-framework laravel-graphql laravel6
Last synced: about 1 month ago
JSON representation
How to Implement GraphQl server with Laravel.
- Host: GitHub
- URL: https://github.com/mobiosolutions/graphql-with-laravel
- Owner: mobiosolutions
- Created: 2020-03-04T10:20:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T11:18:45.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T19:23:05.671Z (about 2 months ago)
- Topics: graphql, laravel, laravel-framework, laravel-graphql, laravel6
- Language: PHP
- Homepage:
- Size: 651 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## **GraphQL with Laravel**
#### **What is GraphQL**
GraphQL is open source data query language for APIs and a runtime for fulfilling those queries with your existing data.
GraphQL was developed internally by Facebook in 2012. GraphQL provides a complete and understandable description of the data in your API,
gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.#### **Why should we use GraphQL**
Apps using GraphQL are fast and stable because they control the data they get, not the server.
Send a GraphQL query to your API and get exactly what you need, nothing more and nothing less.
GraphQL queries always return predictable results.
GraphQL queries access not just the properties of one resource but also smoothly follow references between them.
While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the data your app needs in a single request.
Apps using GraphQL can be quick even on slow mobile network connections.
Access the full capabilities of your data from a single endpoint.
GraphQL uses types to ensure Apps only ask for what’s possible and provide clear and helpful errors.
Apps can use types to avoid writing manual parsing code.
GraphQL APIs give apps continuous access to new features and encourage cleaner, more maintainable server code.
Write GraphQL APIs that leverage your existing data and code with GraphQL engines available in many languages.
You provide functions for each field in the type system, and GraphQL calls them with optimal concurrency.
**Installation and use**
$ git clone https://github.com/mobiosolutions/graphql-with-laravel.git
$ cp .env.example .env
You need to update .env file according to database, username and password.$ composer install
$ php artisan migrate
**Testing the API with GraphQL**For the testing in graphql, we need to download graphql and install it to our system. you can download it from here https://www.electronjs.org/apps/graphiql
and run below command to terminal.php artisan serve
Lets run it on browser.http://127.0.0.1:8000/graphiql
And then you can see the below screen.![picture](img/graphql.png)
Let's write a queries.
Get User
![picture](img/user.png)
That's it. Happy Coding :)