Skip to content

Commit 7ead476

Browse files
authored
Increase docs readability and remove outdated PHP version range (#859)
1 parent 0d43d7b commit 7ead476

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

docs/concepts.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
GraphQL is data-centric. On the very top level it is built around three major concepts:
33
**Schema**, **Query** and **Mutation**.
44

5-
You are expected to express your application as **Schema** (aka Type System) and expose it
6-
with single HTTP endpoint (e.g. using our [standard server](executing-queries.md#using-server)).
5+
You are expected to express your application as a **Schema** (aka Type System) and expose it
6+
as a single HTTP endpoint (e.g. using our [standard server](executing-queries.md#using-server)).
77
Application clients (e.g. web or mobile clients) send **Queries**
88
to this endpoint to request structured data and **Mutations** to perform changes (usually with HTTP POST method).
99

@@ -21,7 +21,7 @@ Queries are expressed in simple language that resembles JSON:
2121
}
2222
```
2323

24-
It was designed to mirror the structure of expected response:
24+
It was designed to mirror the structure of the expected response:
2525
```json
2626
{
2727
"hero": {
@@ -34,9 +34,9 @@ It was designed to mirror the structure of expected response:
3434
}
3535
}
3636
```
37-
**graphql-php** runtime parses Queries, makes sure that they are valid for given Type System
37+
The **graphql-php** runtime parses Queries, makes sure that they are valid for a given Type System
3838
and executes using [data fetching tools](data-fetching.md) provided by you
39-
as a part of integration. Queries are supposed to be idempotent.
39+
as part of the integration. Queries are supposed to be idempotent.
4040

4141
## Mutations
4242
Mutations are root fields that are allowed to have side effects, such as creating, updating or deleting data.
@@ -51,7 +51,7 @@ mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
5151
}
5252
}
5353
```
54-
Variables `$ep` and `$review` are sent alongside with mutation. Full HTTP request might look like this:
54+
Variables `$ep` and `$review` are sent alongside with the mutation. A full HTTP request might look like this:
5555
```json
5656
// POST /graphql-endpoint
5757
// Content-Type: application/javascript
@@ -68,10 +68,10 @@ Variables `$ep` and `$review` are sent alongside with mutation. Full HTTP reques
6868
}
6969
```
7070
As you see variables may include complex objects and they will be correctly validated by
71-
**graphql-php** runtime.
71+
the **graphql-php** runtime.
7272

7373
Another nice feature of GraphQL mutations is that they also hold the query for data to be
74-
returned after mutation. In our example mutation will return:
74+
returned after mutation. In our example the mutation will return:
7575
```
7676
{
7777
"createReview": {
@@ -82,7 +82,7 @@ returned after mutation. In our example mutation will return:
8282
```
8383

8484
# Type System
85-
Conceptually GraphQL type is a collection of fields. Each field in turn
85+
Conceptually a GraphQL type is a collection of fields. Each field in turn
8686
has its own type which allows building complex hierarchies.
8787

8888
Quick example on pseudo-language:
@@ -100,9 +100,9 @@ type User {
100100
}
101101
```
102102

103-
Type system is a heart of GraphQL integration. That's where **graphql-php** comes into play.
103+
The type system is at the heart of GraphQL integration. That's where **graphql-php** comes into play.
104104

105-
It provides following tools and primitives to describe your App as hierarchy of types:
105+
It provides the following tools and primitives to describe your App as a hierarchy of types:
106106

107107
* Primitives for defining **objects** and **interfaces**
108108
* Primitives for defining **enumerations** and **unions**

docs/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Alternatively, you can follow instructions on [the GraphiQL](https://github.com/
3131
page and install it locally.
3232

3333
# Hello World
34-
Let's create a type system that will be capable to process following simple query:
34+
Let's create a type system that will be capable to process the following simple query:
3535
```
3636
query {
3737
echo(message: "Hello World")
@@ -64,12 +64,12 @@ $queryType = new ObjectType([
6464

6565
(Note: type definition can be expressed in [different styles](type-definitions/index.md#definition-styles))
6666

67-
The interesting piece here is **resolve** option of field definition. It is responsible for returning
68-
a value of our field. Values of **scalar** fields will be directly included in response while values of
67+
The interesting piece here is the **resolve** option of the field definition. It is responsible for returning
68+
a value of our field. Values of **scalar** fields will be directly included in the response while values of
6969
**composite** fields (objects, interfaces, unions) will be passed down to nested field resolvers
7070
(not in this example though).
7171

72-
Now when our type is ready, let's create GraphQL endpoint file for it **graphql.php**:
72+
Now when our type is ready, let's create a GraphQL endpoint file for it **graphql.php**:
7373

7474
```php
7575
<?php

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ All of them equally apply to this PHP implementation.
1818

1919
# About graphql-php
2020

21-
**graphql-php** is a feature-complete implementation of GraphQL specification in PHP (5.5+, 7.0+).
21+
**graphql-php** is a feature-complete implementation of GraphQL specification in PHP.
2222
It was originally inspired by [reference JavaScript implementation](https://github.com/graphql/graphql-js)
2323
published by Facebook.
2424

docs/schema-definition.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ Field names of Mutation type are usually verbs and they almost always have argum
7878
with complex input values (see [Mutations and Input Types](type-definitions/inputs.md) for details).
7979

8080
# Configuration Options
81-
Schema constructor expects an instance of [`GraphQL\Type\SchemaConfig`](class-reference.md#graphqltypeschemaconfig)
82-
or an array with following options:
81+
The schema constructor expects an instance of [`GraphQL\Type\SchemaConfig`](class-reference.md#graphqltypeschemaconfig)
82+
or an array with the following options:
8383

8484
Option | Type | Notes
8585
------------ | -------- | -----
8686
query | `ObjectType` | **Required.** Object type (usually named "Query") containing root-level fields of your read API
8787
mutation | `ObjectType` | Object type (usually named "Mutation") containing root-level fields of your write API
8888
subscription | `ObjectType` | Reserved for future subscriptions implementation. Currently presented for compatibility with introspection query of **graphql-js**, used by various clients (like Relay or GraphiQL)
8989
directives | `array<Directive>` | A full list of [directives](type-definitions/directives.md) supported by your schema. By default, contains built-in **@skip** and **@include** directives.<br><br> If you pass your own directives and still want to use built-in directives - add them explicitly. For example:<br><br> *array_merge(GraphQL::getStandardDirectives(), [$myCustomDirective]);*
90-
types | `array<ObjectType>` | List of object types which cannot be detected by **graphql-php** during static schema analysis.<br><br>Most often it happens when the object type is never referenced in fields directly but is still a part of a schema because it implements an interface which resolves to this object type in its **resolveType** callable. <br><br> Note that you are not required to pass all of your types here - it is simply a workaround for concrete use-case.
91-
typeLoader | `callable(string $name): Type` | Expected to return type instance given the name. Must always return the same instance if called multiple times, see [lazy loading](#lazy-loading-of-types). See section below on lazy type loading.
90+
types | `array<ObjectType>` | List of object types which cannot be detected by **graphql-php** during static schema analysis.<br><br>Most often this happens when the object type is never referenced in fields directly but is still a part of a schema because it implements an interface which resolves to this object type in its **resolveType** callable. <br><br> Note that you are not required to pass all of your types here - it is simply a workaround for concrete a use-case.
91+
typeLoader | `callable(string $name): Type` | Expected to return a type instance given the name. Must always return the same instance if called multiple times, see [lazy loading](#lazy-loading-of-types). See section below on lazy type loading.
9292

9393
# Using config class
94-
If you prefer fluid interface for config with auto-completion in IDE and static time validation,
94+
If you prefer a fluid interface for the config with auto-completion in IDE and static time validation,
9595
use [`GraphQL\Type\SchemaConfig`](class-reference.md#graphqltypeschemaconfig) instead of an array:
9696

9797
```php
@@ -110,10 +110,10 @@ $schema = new Schema($config);
110110
By default, the schema will scan all of your type, field and argument definitions to serve GraphQL queries.
111111
It may cause performance overhead when there are many types in the schema.
112112

113-
In this case, it is recommended to pass **typeLoader** option to schema constructor and define all
113+
In this case, it is recommended to pass the **typeLoader** option to the schema constructor and define all
114114
of your object **fields** as callbacks.
115115

116-
Type loading concept is very similar to PHP class loading, but keep in mind that **typeLoader** must
116+
Type loading is very similar to PHP class loading, but keep in mind that the **typeLoader** must
117117
always return the same instance of a type. A good way to ensure this is to use a type registry:
118118

119119
```php
@@ -160,25 +160,25 @@ $schema = new Schema([
160160
]);
161161
```
162162

163-
You can automate this registry as you wish to reduce boilerplate or even
164-
introduce Dependency Injection Container if your types have other dependencies.
163+
You can automate this registry if you wish to reduce boilerplate or even
164+
introduce a Dependency Injection Container if your types have other dependencies.
165165

166166
Alternatively, all methods of the registry could be static - then there is no need
167167
to pass it in the constructor - instead use **TypeRegistry::myAType()** in your type definitions.
168168

169169
# Schema Validation
170170
By default, the schema is created with only shallow validation of type and field definitions
171-
(because validation requires full schema scan and is very costly on bigger schemas).
171+
(because validation requires a full schema scan and is very costly on bigger schemas).
172172

173-
There is a special method **assertValid()** on schema instance which throws
173+
There is a special method **assertValid()** on the schema instance which throws
174174
`GraphQL\Error\InvariantViolation` exception when it encounters any error, like:
175175

176176
- Invalid types used for fields/arguments
177177
- Missing interface implementations
178178
- Invalid interface implementations
179179
- Other schema errors...
180180

181-
Schema validation is supposed to be used in CLI commands or during build step of your app.
181+
Schema validation is supposed to be used in CLI commands or during a build step of your app.
182182
Don't call it in web requests in production.
183183

184184
Usage example:

0 commit comments

Comments
 (0)