mathsgod / gql-scalar-email
GraphQL 标量类型:电子邮件
1.0.3
2019-10-31 08:23 UTC
Requires (Dev)
- phpunit/phpunit: ^6.5
- webonyx/graphql-php: ^0.12.6
This package is auto-updated.
Last update: 2024-09-29 05:22:12 UTC
README
$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);