PHP code example of radic / graphql_streams_api-module
1. Go to this page and download the library: Download radic/graphql_streams_api-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
radic / graphql_streams_api-module example snippets
return [
// other config options redacted, check out the documentation for a full overview
'default_field_resolutions' => [
'anomaly.field_type.addon' => 'String',
'anomaly.field_type.blocks' => 'String',
'anomaly.field_type.boolean' => 'Boolean',
'anomaly.field_type.checkboxes' => 'Boolean',
'anomaly.field_type.colorpicker' => 'String',
//etc...
],
'stream_bindings' => [
// namespace::slug
'users::users' => [
// generator results: type User {}
'type_name' => 'User',
// PyroCMS Stream field assignment => GraphQL field type
'resolutions' => [
// custom type resolutions
'id' => 'ID',
'roles' => '[UserRole!] @hasMany',
'created_at' => 'Date',
'updated_at' => 'Date',
'deleted_at' => 'Date',
// The fields below will be resolved using the `default_field_resolutions`
// If you want, you can assign a custom type resolutions like above
'username',
'display_name',
'first_name',
// protect fields by requiring authentication and permissions
'email' => 'String @role(roles: ["admin"], operator: "AND")',
'email' => 'String @role(roles: ["user", "guest"], operator: "NOT")',
'email' => 'String @role(roles: ["admin", "user"], operator: "OR")',
'last_name',
'activated',
'enabled',
],
],
// other streams...
]
];