Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astrotomic/graphql-query-builder
his package is an opinionated GraphQL Query Builder.
https://github.com/astrotomic/graphql-query-builder
graphql query-builder
Last synced: 14 days ago
JSON representation
his package is an opinionated GraphQL Query Builder.
- Host: GitHub
- URL: https://github.com/astrotomic/graphql-query-builder
- Owner: Astrotomic
- License: mit
- Created: 2021-08-11T13:47:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-11T14:34:21.000Z (over 3 years ago)
- Last Synced: 2024-11-05T15:27:31.219Z (15 days ago)
- Topics: graphql, query-builder
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL Query Builder
This package is an opinionated GraphQL Query Builder not fully compatible with all GraphQL specs (yet).
In case you miss a feature you can open an issue so we can discuss a solution.## Installation
```bash
composer require astrotomic/graphql-query-builder
```## Usage
```php
use Astrotomic\GraphqlQueryBuilder\Graph;
use Astrotomic\GraphqlQueryBuilder\Query;Graph::query(
Query::from('user')
->with(['login' => 'Gummibeer'])
->select(
Query::from('sponsorshipsAsMaintainer')
->with(['first' => 100, 'after' => 'ABC'])
->select(
Query::from('pageInfo')->select('hasNextPage', 'endCursor'),
Query::from('nodes')->select(
Query::from('sponsorEntity')->select(
'__typename',
Query::for('User')->select('login', 'avatarUrl', 'databaseId', 'name'),
Query::for('Organization')->select('login', 'avatarUrl', 'databaseId', 'name'),
)
)
)
)
)
``````graphql
query {
user(login: "Gummibeer") {
sponsorshipsAsMaintainer(first: 100, after: "ABC") {
pageInfo {
hasNextPage
endCursor
}
nodes {
sponsorEntity {
__typename
... on User {
login
avatarUrl
databaseId
name
}
... on Organization {
login
avatarUrl
databaseId
name
}
}
}
}
}
}
```