thecodingmachine / graphqlite
Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).
Installs: 1 387 127
Dependents: 31
Suggesters: 0
Security: 0
Stars: 556
Watchers: 21
Forks: 96
Open Issues: 43
Language:MDX
Requires
- php: >=8.1
- ext-json: *
- composer/package-versions-deprecated: ^1.8
- doctrine/annotations: ^1.14 || ^2.0
- kcs/class-finder: ^0.4.0
- phpdocumentor/reflection-docblock: ^4.3 || ^5.0
- phpdocumentor/type-resolver: ^1.4
- psr/container: ^1.1 || ^2
- psr/http-factory: ^1
- psr/http-message: ^1.0.1 || ^2.0
- psr/http-server-handler: ^1
- psr/http-server-middleware: ^1
- psr/simple-cache: ^1.0.1 || ^2 || ^3
- symfony/cache: ^4.3 || ^5 || ^6 || ^7
- symfony/expression-language: ^4 || ^5 || ^6 || ^7
- thecodingmachine/cache-utils: ^1
- webonyx/graphql-php: ^v15.0
Requires (Dev)
- beberlei/porpaginas: ^1.2 || ^2.0
- doctrine/coding-standard: ^11.0 || ^12.0
- ecodev/graphql-upload: ^7.0
- laminas/laminas-diactoros: ^2 || ^3
- myclabs/php-enum: ^1.6.6
- php-coveralls/php-coveralls: ^2.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^8.5.19 || ^9.5.8
- symfony/var-dumper: ^5.4 || ^6.0 || ^7
- thecodingmachine/phpstan-strict-rules: ^1.0
Suggests
- beberlei/porpaginas: If you want automatic pagination in your GraphQL types
- ecodev/graphql-upload: If you want to support file upload inside GraphQL input types
- v7.0.0
- v6.2.3
- v6.2.2
- v6.2.1
- v6.2.0
- v6.1.0
- v6.0.0
- 5.0.x-dev
- dev-master / 5.0.x-dev
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- v4.3.0
- v4.1.2
- v4.1.1
- v4.1.0
- 4.0.x-dev
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- 3.1.x-dev
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- 3.0.x-dev
- v3.0.1
- v3.0.0
- dev-dependabot-github_actions-JamesIves-github-pages-deploy-action-4.6.8
- dev-dependabot-github_actions-actions-upload-artifact-4
- dev-snyk-upgrade-4b859eae02860ba2db764d2ef95b07f1
- dev-dependabot-composer-phpunit-phpunit-tw-8.5.19or-tw-9.5.8or-tw-10.0.0
- dev-snyk-upgrade-eb194ee4b262406edd1dbdb2529c16a3
- dev-snyk-upgrade-9bb9dd3f5f0ffb24ec0c97194d8038fc
This package is auto-updated.
Last update: 2024-10-07 05:01:46 UTC
README
GraphQLite
GraphQL in PHP made easy.
A GraphQL library for PHP that allows you to use attributes (or annotations) to define your schema and write your queries and mutations using simple-to-write controllers.
Features
- Create a complete GraphQL API by simply annotating your PHP classes
- Framework agnostic, but with Symfony and Laravel integrations available!
- Comes with batteries included 🔋: queries, mutations, subscriptions, mapping of arrays/iterators, file uploads, extendable types and more!
Basic example
First, declare a mutation in your controller:
class ProductController { #[Mutation] public function updateProduct(Product $product): Product { // Some code that gets and updates a Product return $product; } }
Then, annotate the Product
class to declare what fields are exposed to the GraphQL API:
#[Type] #[Input(update: true)] class Product { #[Field] public function getName(): string { return $this->name; } #[Field] public function setName(string $name): void { $this->name = $name; } // ... }
That's it, you're good to go 🎉 mutate away!
{ updateProduct(product: { name: 'John Doe' }) { name } }
Want to learn more? Head to the documentation!
Contributing
Contributions are welcomed via pull requests. If you'd like to discuss prior to submitting a PR, consider a discussion. If it's a bug/issue, you can submit an issue first.
All PRs should have sufficient test coverage for any additions or changes. PRs will not be merged without these.