https://github.com/mathsgod/gql-scalar-email
https://github.com/mathsgod/gql-scalar-email
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mathsgod/gql-scalar-email
- Owner: mathsgod
- License: mit
- Created: 2019-10-31T07:36:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-31T09:55:41.000Z (over 6 years ago)
- Last Synced: 2025-05-13T22:24:10.016Z (about 1 year ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gql-scalar-email
```php
$gql = "
scalar Email
type Query{
test(email:Email):Email
}
";
$typeConfigDecorator = function ($typeConfig) {
$name = $typeConfig['name'];
if ($name === 'Email') {
$email = new Scalar\Email();
$typeConfig["serialize"] = [$email, "serialize"];
$typeConfig["parseLiteral"] = [$email, "parseLiteral"];
}
return $typeConfig;
};
$schema = BuildSchema::build($gql, $typeConfigDecorator);
```