GraphQL Projection Generator for Laravel
Пакет для генерації PHP об'єктів із сутностей GraphQL схеми:
- Генерація всіх сутностей GraphQL схеми в об'єкти PHP
- Підтримка аргументів в проекції
- Підтримка відправки файлів
- Типізація
- IDE autocompletion
- Тестування запитів GraphQL
#laravel #graphql #codegen
Пакет для генерації PHP об'єктів із сутностей GraphQL схеми:
- Генерація всіх сутностей GraphQL схеми в об'єкти PHP
- Підтримка аргументів в проекції
- Підтримка відправки файлів
- Типізація
- IDE autocompletion
- Тестування запитів GraphQL
$input = ArticleInput::builder()
->title('My First Article')
->content('Article content here...')
->build();
// Create query
$query = CreateArticleGraphQLQuery::newRequest()
->input($input)
->build();
// Define projection (select fields)
$projection = CreateArticleProjection::new()
->id()
->title()
->author()
->name()
->email()
->getRoot();
// Execute and get typed response
$request = new GraphQLQueryRequest($query, $projection);
$article = $this->graphql()->executeAndExtract($request);
// Work with typed object
$this->assertInstanceOf(Article::class, $article);
$this->assertEquals('My First Article', $article->getTitle());
#laravel #graphql #codegen
GitHub
GitHub - fedorgrecha/php-graphql-projection: GraphQL projections generator for laravel
GraphQL projections generator for laravel. Contribute to fedorgrecha/php-graphql-projection development by creating an account on GitHub.
1🔥6