Skip to content

Commit a2b9e2b

Browse files
authored
Merge pull request mghoneimy#24 from mcg-web/patch-1
Add code syntax highlighting colors
2 parents 7d5f50d + 919eb0d commit a2b9e2b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ https://github.com/mghoneimy/php-graphql-oqm)
4747

4848
## Simple Query
4949

50-
```
50+
```php
5151
$gql = (new Query('companies'))
5252
->setSelectionSet(
5353
[
@@ -61,7 +61,7 @@ This simple query will retrieve all companies displaying their names and serial
6161
numbers.
6262

6363
## Nested Queries
64-
```
64+
```php
6565
$gql = (new Query('companies'))
6666
->setSelectionSet(
6767
[
@@ -87,7 +87,7 @@ displaying their dates.
8787

8888
## Query With Arguments
8989

90-
```
90+
```php
9191
$gql = (new Query('companies'))
9292
->setArguments(['name' => 'Tech Co.', 'first' => 3])
9393
->setSelectionSet(
@@ -104,7 +104,7 @@ and serial numbers.
104104

105105
## Query With Array Argument
106106

107-
```
107+
```php
108108
$gql = (new Query('companies'))
109109
->setArguments(['serialNumbers' => [159, 260, 371]])
110110
->setSelectionSet(
@@ -121,7 +121,7 @@ displaying the name and serial number.
121121

122122
## Query With Input Object Argument
123123

124-
```
124+
```php
125125
$gql = (new Query('companies'))
126126
->setArguments(['filter' => new RawObject('{name_starts_with: "Face"}')])
127127
->setSelectionSet(
@@ -145,7 +145,7 @@ query class.
145145

146146
## Query With Variables
147147

148-
```
148+
```php
149149
$gql = (new Query('companies'))
150150
->setVariables(
151151
[
@@ -185,7 +185,7 @@ inline fragments to access data on the underlying concrete type.
185185

186186
This example show how to generate inline fragments using this package:
187187

188-
```
188+
```php
189189
$gql = new Query('companies');
190190
$gql->setSelectionSet(
191191
[
@@ -211,7 +211,7 @@ Query building is divided into steps.
211211
That's how the "Query With Input Object Argument" example can be created using
212212
the QueryBuilder:
213213

214-
```
214+
```php
215215
$builder = (new QueryBuilder('companies'))
216216
->setVariable('namePrefix', 'String', true)
217217
->setArgument('filter', new RawObject('{name_starts_with: $namePrefix}'))
@@ -231,7 +231,7 @@ to the GraphQL server.
231231

232232
Example:
233233

234-
```
234+
```php
235235
$client = new Client(
236236
'http://api.graphql.com',
237237
['Authorization' => 'Basic xyz']
@@ -243,7 +243,7 @@ The Client constructor also receives an optional "httpOptions" array, which **ov
243243

244244
Example:
245245

246-
```
246+
```php
247247
$client = new Client(
248248
'http://api.graphql.com',
249249
[],
@@ -272,13 +272,13 @@ $client = new Client(
272272
Running query with the GraphQL client and getting the results in object
273273
structure:
274274

275-
```
275+
```php
276276
$results = $client->runQuery($gql);
277277
$results->getData()->Company[0]->branches;
278278
```
279279
Or getting results in array structure:
280280

281-
```
281+
```php
282282
$results = $client->runQuery($gql, true);
283283
$results->getData()['Company'][1]['branches']['address']
284284
```
@@ -289,7 +289,7 @@ Running queries containing variables requires passing an associative array which
289289
maps variable names (keys) to variable values (values) to the `runQuery` method.
290290
Here's an example:
291291

292-
```
292+
```php
293293
$gql = (new Query('companies'))
294294
->setVariables(
295295
[
@@ -315,7 +315,7 @@ returned objects, receive arguments, and can have sub-fields.
315315

316316
Here's a sample example on how to construct and run mutations:
317317

318-
```
318+
```php
319319
$mutation = (new Mutation('createCompany'))
320320
->setArguments(['companyObject' => new RawObject('{name: "Trial Company", employees: 200}')])
321321
->setSelectionSet(
@@ -336,7 +336,7 @@ Mutations can utilize the variables in the same way Queries can. Here's an
336336
example on how to use the variables to pass input objects to the GraphQL server
337337
dynamically:
338338

339-
```
339+
```php
340340
$mutation = (new Mutation('createCompany'))
341341
->setVariables([new Variable('company', 'CompanyInputObject', true)])
342342
->setArguments(['companyObject' => '$company']);
@@ -349,7 +349,7 @@ $client->runQuery(
349349

350350
These are the resulting mutation and the variables passed with it:
351351

352-
```
352+
```php
353353
mutation($company: CompanyInputObject!) {
354354
createCompany(companyObject: $company)
355355
}
@@ -368,7 +368,7 @@ API link: https://graphql-pokemon.now.sh/
368368

369369
This query retrieves any pokemon's evolutions and their attacks:
370370

371-
```
371+
```php
372372
query($name: String!) {
373373
pokemon(name: $name) {
374374
id
@@ -398,7 +398,7 @@ query($name: String!) {
398398
That's how this query can be written using the query class and run using the
399399
client:
400400

401-
```
401+
```php
402402
$client = new Client(
403403
'https://graphql-pokemon.now.sh/'
404404
);
@@ -447,7 +447,7 @@ print_r($results->getData()['pokemon']);
447447
Or alternatively, That's how this query can be generated using the QueryBuilder
448448
class:
449449

450-
```
450+
```php
451451
$client = new Client(
452452
'https://graphql-pokemon.now.sh/'
453453
);
@@ -489,7 +489,7 @@ Although not the primary goal of this package, but it supports running raw
489489
string queries, just like any other client using the `runRawQuery` method in the
490490
`Client` class. Here's an example on how to use it:
491491

492-
```
492+
```php
493493
$gql = <<<QUERY
494494
query {
495495
pokemon(name: "Pikachu") {

0 commit comments

Comments
 (0)