mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 14:26:08 +03:00
Update README.md
This commit is contained in:
parent
f91cbf3409
commit
a31cd9db3e
32
README.md
32
README.md
@ -29,6 +29,38 @@ This implementation will follow JavaScript version as close as possible until Gr
|
|||||||
## Overview
|
## Overview
|
||||||
GraphQL is intended to be a replacement for REST APIs. [Read more](http://facebook.github.io/react/blog/2015/05/01/graphql-introduction.html) about rationale behind it.
|
GraphQL is intended to be a replacement for REST APIs. [Read more](http://facebook.github.io/react/blog/2015/05/01/graphql-introduction.html) about rationale behind it.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```php
|
||||||
|
$result = GraphQL::execute(
|
||||||
|
StarWarsSchema::build(),
|
||||||
|
'query HeroNameAndFriendsQuery {
|
||||||
|
hero {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
friends {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Result returned:
|
||||||
|
```
|
||||||
|
[
|
||||||
|
'hero' => [
|
||||||
|
'id' => '2001',
|
||||||
|
'name' => 'R2-D2',
|
||||||
|
'friends' => [
|
||||||
|
['name' => 'Luke Skywalker'],
|
||||||
|
['name' => 'Han Solo'],
|
||||||
|
['name' => 'Leia Organa'],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
This PHP implementation is a thin wrapper around your existing data layer and business logic. It doesn't dictate how these layers are implemented or which storage engines are used. Instead it provides tools for creating API for your existing app. These tools include:
|
This PHP implementation is a thin wrapper around your existing data layer and business logic. It doesn't dictate how these layers are implemented or which storage engines are used. Instead it provides tools for creating API for your existing app. These tools include:
|
||||||
- Type system
|
- Type system
|
||||||
- Schema validation and introspection
|
- Schema validation and introspection
|
||||||
|
Loading…
Reference in New Issue
Block a user