{"id":19012166,"url":"https://github.com/garlicservices/graphql-wrapper-bundle","last_synced_at":"2026-05-13T13:49:29.767Z","repository":{"id":62509093,"uuid":"161650214","full_name":"garlicservices/graphql-wrapper-bundle","owner":"garlicservices","description":"This bundle allow microservices communicate to each other using GraphQL query builder","archived":false,"fork":false,"pushed_at":"2019-04-19T11:28:27.000Z","size":37,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-01T21:47:33.801Z","etag":null,"topics":["graphql","graphql-wrapper"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garlicservices.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-13T14:25:05.000Z","updated_at":"2019-04-19T11:27:17.000Z","dependencies_parsed_at":"2022-11-02T10:16:28.865Z","dependency_job_id":null,"html_url":"https://github.com/garlicservices/graphql-wrapper-bundle","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garlicservices%2Fgraphql-wrapper-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garlicservices%2Fgraphql-wrapper-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garlicservices%2Fgraphql-wrapper-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garlicservices%2Fgraphql-wrapper-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garlicservices","download_url":"https://codeload.github.com/garlicservices/graphql-wrapper-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240043747,"owners_count":19739161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-wrapper"],"created_at":"2024-11-08T19:17:02.250Z","updated_at":"2025-11-11T13:31:21.691Z","avatar_url":"https://github.com/garlicservices.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Garlic GraphQL wrapper\n\nThis bundle allow microservices communicate to each other using GraphQL query builder\n\n## Installation\n\nJust a couple things are necessary for this bundle works. \n\n### Add garlic/bus bundle to your composer.json\n\n```bash\ncomposer require garlic/graphql-wrapper\n```\n\n### GraphQL way to get result from service (several services)\n\n**Important:** If you want to use GraphQL wrapper you have to install [garlicservices/graphql-bundle](https://github.com/garlicservices/graphql-bundle) on all the services you requiested in your queries.\nTo install bundle on application just type in console the command showed below\n```bash\ncomposer require garlic/grpahql-bundle\n```\n#### Easy way to use GraphQl query\n\nSimple example of querying data from remote microservice\n\n````php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressQuery = $graphQLService-\u003ecreateQuery('serviceName.QueryName');\n$addressQuery\n    -\u003eselect('id', 'city', 'zipcode')\n    -\u003ewhere('country = Ukraine');\n\n$result = $graphQLService-\u003efetch();\n````\n\n#### Querying internal related objects\n\nExample of querying data from related objects\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('serviceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'buildYear', 'address.id', 'address.city', 'address.country')\n    -\u003ewhere('size = 5');\n    \n$result = $graphQLService-\u003efetch();    \n```\n\n#### Searching on internal related objects\n\nExample of searching data on included objects\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('serviceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'buildYear', 'address.id', 'address.city', 'address.country')\n    -\u003ewhere('size = 5', 'address.country = Ukraine');\n    \n$result = $graphQLService-\u003efetch();\n```\n\n#### Querying external related objects (stitchOne)\n\nExample of query stitching to one another by using stitchOne() method (stitched result will be included as an object)\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressQuery = $graphQLService-\u003ecreateQuery('firstServiceName.QueryName');\n$addressQuery\n    -\u003eselect('id', 'city', 'country')\n    -\u003ewhere('country = Ukraine')\n;\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('secondServiceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'size', 'addressId')\n    -\u003ewhere('size = 5')\n    -\u003estitchOne($addressQuery, 'address', 'addressId', 'id')\n;\n\n$result = $graphQLService-\u003efetch();\n```\n\n#### Querying external related list of objects (stitchMany) \n\nExample of stitching queries to one another by using stitchMany() method (stitched result will be included as list of objects)\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressQuery = $graphQLService-\u003ecreateQuery('firstServiceName.QueryName');\n$addressQuery\n    -\u003eselect('id', 'city', 'country')\n    -\u003ewhere('country = Ukraine')\n;\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('secondServiceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'size', 'addressId')\n    -\u003ewhere('size = 5')\n    -\u003estitchMany($addressQuery, 'address', 'addressId', 'id')\n;\n\n$result = $graphQLService-\u003efetch();\n```\n\n#### Querying stitching by using internally included objects\n\nExample of stitching queries with fields from internally included objects\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressQuery = $graphQLService-\u003ecreateQuery('firstServiceName.QueryName');\n$addressQuery\n    -\u003eselect('id', 'city', 'country')\n    -\u003ewhere('country = Ukraine')\n;\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('secondServiceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'size', 'address.id', 'address.city', 'address.country')\n    -\u003ewhere('size = 5')\n    -\u003estitchOne($addressQuery, 'fullAddress', 'address.id', 'id')\n;\n\n$result = $graphQLService-\u003efetch();\n```\n\n#### Passing request headers\nYou could pass any headers you want just by using `addHeader` method on created query:\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('secondServiceName.QueryName');\n$apartmentQuery\n    -\u003eselect(...)\n    -\u003ewhere(...)\n    -\u003eaddHeader('Authorization', 'abc');\n```\n\n\n### GraphQL mutations\n\nMutation is the way to change service data by sending some kinds of query. What this queries are and how they could created read below.\n\n#### Create new data with GraphQL mutation\n\nExample of creating new data row on remote microservice. Method \"set\" put new fields data in a query and method \"select\" contains fields that will be returned after query done.   \n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentMutation = $graphQLService-\u003ecreateNewMutation('ServiceName.CreateMutationName');\n$apartmentMutation\n    -\u003eset('size = 3', 'buildYear = 2018')\n    -\u003eselect('id');\n    \n$result = $graphQLService-\u003efetch();    \n```\n\n#### Update data with GraphQL mutation\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentMutation = $graphQLService-\u003ecreateUpdateMutation('ServiceName.UpdateMutationName');\n$apartmentMutation\n    -\u003eset('size = 3', 'buildYear = 2018')\n    -\u003ewhere('size = 5')\n    -\u003eselect('id');\n    \n$result = $graphQLService-\u003efetch();    \n```\n\n#### Delete data with GraphQL mutation\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$apartmentMutation = $graphQLService-\u003ecreateDeleteMutation('ServiceName.DeleteMutationName');\n$apartmentMutation\n    -\u003ewhere('size = 5')\n    -\u003eselect('id');\n    \n$result = $graphQLService-\u003efetch();    \n```\n\n#### Making async batch request with parallel processing\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressMutation = $graphQLService-\u003ecreateNewMutation('template.AddressCreate');\n$addressMutation\n    -\u003eselect('id', 'country', 'city')\n    -\u003eset('country = Ukraine', 'city = Boyarka', 'street = Kyivska', 'zipcode = 20214', 'house = 1');\n\n$apartmentQuery = $graphQLService-\u003ecreateQuery('template.AddressFind');\n$apartmentQuery\n    -\u003eselect('id')\n    -\u003ewhere(['id' =\u003e 123])\n;\n\n$result = $graphQLService-\u003efetchAsync(); \n```\n\n#### Query stitching in Mutation\n\nQuery stitching works the same way as in query mode. Just try, it's amazing!\n\nExample of Create Mutation with next stitching to the query.\n\n```php\n$graphQLService = $this-\u003eget(GraphQLService::class);\n\n$addressMutation = $graphQLService-\u003ecreateNewMutation('FirstServiceName.CreateMutationName');\n$addressMutation\n    -\u003eset('city = Kyiv', 'country = Ukraine')\n    -\u003eselect('id');\n    \n$apartmentQuery = $graphQLService-\u003ecreateQuery('SecondServiceName.QueryName');\n$apartmentQuery\n    -\u003eselect('id', 'size', 'address.id', 'address.city', 'address.country')\n    -\u003ewhere('size = 5')\n    -\u003estitchOne($addressMutation, 'newAddress', 'address.country', 'country')\n;    \n    \n$result = $graphQLService-\u003efetch();    \n```\n\nYou can use stitching with query and mutation and vise-versa. Even several mutation can be stitched to one another.\n\n## Enjoy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarlicservices%2Fgraphql-wrapper-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarlicservices%2Fgraphql-wrapper-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarlicservices%2Fgraphql-wrapper-bundle/lists"}