Skip to content

Commit fb644ed

Browse files
authored
Merge pull request #267 from andrew-demb/readme
📖 Improve readme
2 parents b29e08b + e50f63e commit fb644ed

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,93 @@
55
# GraphQLite bundle
66

77
Symfony bundle for the `thecodingmachine/graphqlite` package.
8+
It discovers your annotated controllers and types, builds the schema, exposes the `/graphql` endpoint through a PSR-7
9+
bridge (with optional upload handling), and keeps the Symfony request available as the GraphQL context.
810

9-
Bundle docs: https://graphqlite.thecodingmachine.io/docs/symfony-bundle
11+
Part of the bundle docs: https://graphqlite.thecodingmachine.io/docs/symfony-bundle
1012

1113
See [thecodingmachine/graphqlite](https://github.com/thecodingmachine/graphqlite).
14+
15+
## Requirements
16+
17+
- PHP 8.1+
18+
- Supports:
19+
- Symfony 6.4/7.0/8.0
20+
- GraphQLite ^8
21+
22+
## Installation
23+
24+
```bash
25+
composer require thecodingmachine/graphqlite-bundle
26+
```
27+
28+
Ensure the bundle is enabled (Symfony Flex does this automatically via `config/bundles.php` after `composer require`).
29+
30+
### Configure routes
31+
32+
Import the bundle routes to expose `/graphql`:
33+
34+
```yaml
35+
# config/routes/graphqlite.yaml
36+
graphqlite_bundle:
37+
resource: '@GraphQLiteBundle/Resources/config/routes.php'
38+
```
39+
40+
### Configure namespaces
41+
42+
Tell GraphQLite where to look for controllers and types:
43+
44+
```yaml
45+
# config/packages/graphqlite.yaml
46+
graphqlite:
47+
namespace:
48+
controllers: App\\GraphQL\\Controller
49+
types:
50+
- App\\GraphQL\\Type
51+
- App\\Entity
52+
```
53+
54+
## Quickstart
55+
56+
Create a controller with GraphQLite attributes:
57+
58+
```php
59+
<?php
60+
// src/GraphQL/Controller/HelloController.php
61+
namespace App\GraphQL\Controller;
62+
63+
use TheCodingMachine\GraphQLite\Annotations\Query;
64+
65+
final class HelloController
66+
{
67+
#[Query]
68+
public function hello(string $name = 'world'): string
69+
{
70+
return sprintf('Hello %s', $name);
71+
}
72+
}
73+
```
74+
75+
## Features
76+
77+
- Auto-discovers controllers and types from configured namespaces and registers GraphQLite services, query providers,
78+
type mappers, and middleware through Symfony autoconfiguration
79+
- Ships a `/graphql` route that converts Symfony requests to PSR-7 and keeps the Symfony request in the GraphQL context
80+
- Passes the Symfony request as context to allow using them in queries/mutations
81+
- Supports multipart uploads when `graphql-upload` is installed
82+
- Integrates with Symfony Security for `#[Logged]`/`#[Right]` checks
83+
- Expose `login`/`logout` mutations plus a `me` query (opt-out)
84+
- Symfony Validator-based user input validation
85+
- Lets you cap introspection, query depth, and query complexity via configuration
86+
- Uses Symfony cache (APCu or PHP files) for schema caching
87+
- Includes a `graphqlite:dump-schema` console command to export GraphQL SDL
88+
89+
## GraphiQL (playground)
90+
91+
The bundle wires Overblog’s GraphiQL bundle if it is installed. See https://github.com/overblog/GraphiQLBundle for
92+
enabling the UI alongside the `/graphql` endpoint.
93+
94+
## Development
95+
96+
- Tests: `vendor/bin/phpunit`
97+
- Static analysis: `composer phpstan`

0 commit comments

Comments
 (0)