Added "Learn by example" section to Readme

This commit is contained in:
vladar 2016-10-23 05:31:12 +07:00
parent 5125741899
commit 96e4f01ee6

View File

@ -13,6 +13,7 @@ This implementation will follow JavaScript version as close as possible until Gr
- [Overview](#overview) - [Overview](#overview)
- [Installation](#installing-graphql-php) - [Installation](#installing-graphql-php)
- [Learn by example](#learn-by-example)
- [Type System](#type-system) - [Type System](#type-system)
- [Internal Types](#internal-types) - [Internal Types](#internal-types)
- [Enums](#enums) - [Enums](#enums)
@ -81,6 +82,13 @@ If you are upgrading, see [upgrade instructions](UPGRADE.md)
## Requirements ## Requirements
PHP >=5.4 PHP >=5.4
## Learn by example
It is often easier to start with full-featured example and then get back to documentation
for your own work.
Check out full-featured [example of GraphQL API](https://github.com/webonyx/graphql-php/tree/master/examples/01-blog).
Follow instructions and try it yourself in ~10 minutes.
## Getting Started ## Getting Started
First, make sure to read [Getting Started](https://github.com/facebook/graphql#getting-started) section of GraphQL documentation. First, make sure to read [Getting Started](https://github.com/facebook/graphql#getting-started) section of GraphQL documentation.
Examples below implement the type system described in this document. Examples below implement the type system described in this document.
@ -283,7 +291,7 @@ $humanType = new ObjectType([
Option | Type | Notes Option | Type | Notes
------ | ---- | ----- ------ | ---- | -----
name | `string` | Required. Unique name of this object type within Schema name | `string` | Required. Unique name of this object type within Schema
fields | `array` | Required. List of fields describing object properties. See [Fields](#Fields) section for available options. fields | `array` | Required. List of fields describing object properties. See [Fields](#fields) section for available options.
description | `string` | Textual description of this type for clients description | `string` | Textual description of this type for clients
interfaces | `array` or `callback() => ObjectType[]` | List of interfaces implemented by this type (or callback returning list of interfaces) interfaces | `array` or `callback() => ObjectType[]` | List of interfaces implemented by this type (or callback returning list of interfaces)
isTypeOf | `callback($value, $context, GraphQL\Type\Definition\ResolveInfo $info)` | Callback that takes `$value` provided by your data layer and returns true if that `$value` qualifies for this type isTypeOf | `callback($value, $context, GraphQL\Type\Definition\ResolveInfo $info)` | Callback that takes `$value` provided by your data layer and returns true if that `$value` qualifies for this type