Skip to content

Commit a2f10d2

Browse files
leocavalcanteleebyron
authored andcommitted
Add Siler to PHP code section (graphql#464)
* Add Siler to PHP code section * Fix example to use 'hello' and 'world' words
1 parent 0f1bb3c commit a2f10d2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

site/code/index.html.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,47 @@ Apollo Server also supports all Node.js HTTP server frameworks: Express, Connect
304304
- [graphql-php](https://github.com/webonyx/graphql-php): A PHP port of GraphQL reference implementation
305305
- [graphql-relay-php](https://github.com/ivome/graphql-relay-php): A library to help construct a graphql-php server supporting react-relay.
306306
307+
#### [Siler](https://siler.leocavalcante.com/graphql/) ([github](https://github.com/leocavalcante/siler))
308+
309+
Siler is a PHP library powered with high-level abstractions to work with GraphQL.
310+
311+
To run a Siler hello world script:
312+
313+
\`\`\`graphql
314+
type Query {
315+
hello: String
316+
}
317+
\`\`\`
318+
319+
\`\`\`php
320+
<?php
321+
declare(strict_types=1);
322+
require_once '/path/to/vendor/autoload.php';
323+
324+
use Siler\Diactoros;
325+
use Siler\Graphql;
326+
use Siler\Http;
327+
328+
$typeDefs = file_get_contents(__DIR__.'/schema.graphql');
329+
$resolvers = [
330+
'Query' => [
331+
'hello' => 'world',
332+
],
333+
];
334+
$schema = Graphql\schema($typeDefs, $resolvers);
335+
336+
echo "Server running at http://127.0.0.1:8080\n";
337+
Http\server(Graphql\psr7($schema), function (\Throwable $err) {
338+
var_dump($err);
339+
return Diactoros\json([
340+
'error' => true,
341+
'message' => $err->getMessage(),
342+
]);
343+
})()->run();
344+
\`\`\`
345+
346+
It also provides functionality for the construction of a WebSocket Subscriptions Server based on how Apollo works.
347+
307348
### Python
308349
309350
#### [Graphene](http://graphene-python.org/) ([github](https://github.com/graphql-python/graphene))

0 commit comments

Comments
 (0)