Skip to content

Commit 10c1197

Browse files
authored
Updated docs for v8.0.0 (#720)
1 parent 796e4cb commit 10c1197

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+5661
-2
lines changed

website/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ The [versioning section of the Docusaurus documentation](https://docusaurus.io/d
5050
```bash
5151
$ docusaurus docs:version 1.1
5252
```
53-
*Be sure to include the X.X in the version, not just X.*
53+
*Be sure to include the X.X.X in the version, not just X.*
5454
3. Technically, you're done, just commit these changes and the CI workflow will deploy when merged into `master`.

website/docs/CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ title: Changelog
44
sidebar_label: Changelog
55
---
66

7+
## 8.0.0
8+
9+
### Breaking Changes
10+
11+
- [#677 Drops support for Doctrine annotations](https://github.com/thecodingmachine/graphqlite/pull/677) @fogrye
12+
13+
### Improvements
14+
15+
- [#668 Adds working examples to docs](https://github.com/thecodingmachine/graphqlite/pull/668) @shish
16+
- [#698 Performance optimizations and caching in development environments (`devMode()`)](https://github.com/thecodingmachine/graphqlite/pull/698) @oprypkhantc]
17+
18+
### Bug Fixes
19+
20+
- [#702 Fix prefetching for nested fields](https://github.com/thecodingmachine/graphqlite/pull/702) @sudevva
21+
22+
### Minor Changes
23+
24+
- [#695 Removes dependecy to unmaintained thecodingmachine/cache-utils dependency](https://github.com/thecodingmachine/graphqlite/pull/695) @xyng
25+
- [#712 Caching improvements with use of multiple ClassFinders](https://github.com/thecodingmachine/graphqlite/pull/712) @andrew-demb
26+
727
## 7.1.0
828

929
### Breaking Changes
@@ -14,7 +34,7 @@ sidebar_label: Changelog
1434
- Removed `FactoryContext::get*TTL()` and `RootTypeMapperFactoryContext::get*TTL()` as GraphQLite no longer uses TTLs to invalidate caches
1535
- Removed `StaticClassListTypeMapper` in favor of `ClassFinderTypeMapper` used with `StaticClassFinder`
1636
- Renamed `GlobTypeMapper` to `ClassFinderTypeMapper`
17-
- Renamed `SchemaFactory::setClassBoundCacheContractFactory()` to `SchemaFactory::setClassBoundCache()`,
37+
- Renamed `SchemaFactory::setClassBoundCacheContractFactory()` to `SchemaFactory::setClassBoundCache()`,
1838
`FactoryContext::getClassBoundCacheContractFactory()` to `FactoryContext::getClassBoundCache()` and changed their signatures
1939
- Removed `RootTypeMapperFactoryContext::getTypeNamespaces()` in favor of `RootTypeMapperFactoryContext::getClassFinder()`
2040

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
sidebar_label: Changelog
5+
---
6+
7+
## 8.0.0
8+
9+
### Breaking Changes
10+
11+
- [#677 Drops support for Doctrine annotations](https://github.com/thecodingmachine/graphqlite/pull/677) @fogrye
12+
13+
### Improvements
14+
15+
- [#668 Adds working examples to docs](https://github.com/thecodingmachine/graphqlite/pull/668) @shish
16+
- [#698 Performance optimizations and caching in development environments (`devMode()`)](https://github.com/thecodingmachine/graphqlite/pull/698) @oprypkhantc]
17+
18+
### Bug Fixes
19+
20+
- [#702 Fix prefetching for nested fields](https://github.com/thecodingmachine/graphqlite/pull/702) @sudevva
21+
22+
### Minor Changes
23+
24+
- [#695 Removes dependecy to unmaintained thecodingmachine/cache-utils dependency](https://github.com/thecodingmachine/graphqlite/pull/695) @xyng
25+
- [#712 Caching improvements with use of multiple ClassFinders](https://github.com/thecodingmachine/graphqlite/pull/712) @andrew-demb
26+
27+
## 7.1.0
28+
29+
### Breaking Changes
30+
31+
- #698 Removes some methods and classes, namely:
32+
- Deprecated `SchemaFactory::addControllerNamespace()` and `SchemaFactory::addTypeNamespace()` in favor of `SchemaFactory::addNamespace()`
33+
- Deprecated `SchemaFactory::setGlobTTL()` in favor of `SchemaFactory::devMode()` and `SchemaFactory::prodMode()`
34+
- Removed `FactoryContext::get*TTL()` and `RootTypeMapperFactoryContext::get*TTL()` as GraphQLite no longer uses TTLs to invalidate caches
35+
- Removed `StaticClassListTypeMapper` in favor of `ClassFinderTypeMapper` used with `StaticClassFinder`
36+
- Renamed `GlobTypeMapper` to `ClassFinderTypeMapper`
37+
- Renamed `SchemaFactory::setClassBoundCacheContractFactory()` to `SchemaFactory::setClassBoundCache()`,
38+
`FactoryContext::getClassBoundCacheContractFactory()` to `FactoryContext::getClassBoundCache()` and changed their signatures
39+
- Removed `RootTypeMapperFactoryContext::getTypeNamespaces()` in favor of `RootTypeMapperFactoryContext::getClassFinder()`
40+
41+
### Improvements
42+
43+
- #698 Performance optimizations and caching in development environments (`devMode()`). @oprypkhantc
44+
45+
## 7.0.0
46+
47+
### Breaking Changes
48+
49+
- #664 Replaces [thecodingmachine/class-explorer](https://github.com/thecodingmachine/class-explorer) with [kcs/class-finder](https://github.com/alekitto/class-finder) resulting in the `SchemaFactory::setClassNameMapper` being renamed to `SchemaFactory::setFinder`. This now expects an instance of `Kcs\ClassFinder\Finder` instead of `Kcs\ClassFinder\Finder\FinderInterface`. @fogrye
50+
51+
### New Features
52+
53+
- #649 Adds support for `subscription` operations. @oojacoboo
54+
- #612 Automatic query complexity analysis. @oprypkhantc
55+
- #611 Automatic persisted queries. @oprypkhantc
56+
57+
### Improvements
58+
59+
- #658 Improves on prefetching for nested fields. @grynchuk
60+
- #646 Improves exception handling during schema parsing. @fogrye
61+
- #636 Allows the use of middleware on construtor params/fields. @oprypkhantc
62+
- #623 Improves support for description arguments on types/fields. @downace
63+
- #628 Properly handles `@param` annotations for generics support on field annotated constructor arguments. @oojacoboo
64+
- #584 Immutability improvements across the codebase. @oprypkhantc
65+
- #588 Prefetch improvements. @oprpkhantc
66+
- #606 Adds support for phpdoc descriptions and deprecation annotations on native enums. @mdoelker
67+
- Thanks to @shish, @cvergne and @mshapovalov for updating the docs!
68+
69+
### Minor Changes
70+
71+
- #639 Added support for Symfony 7. @janatjak
72+
73+
74+
## 6.2.3
75+
76+
Adds support for `Psr\Container` 1.1 with #601
77+
78+
## 6.2.2
79+
80+
This is a very simple release. We support Doctrine annotation 1.x and we've deprecated `SchemaFactory::setDoctrineAnnotationReader` in favor of native PHP attributes.
81+
82+
## 6.2.1
83+
84+
- Added support for new `Void` return types, allowing use of `void` from operation resolvers. #574
85+
- Improvements with authorization middleware #571
86+
- Updated vendor dependencies: #580 #558
87+
88+
## 6.2.0
89+
90+
Lots of little nuggets in this release! We're now targeting PHP ^8.1 and have testing on 8.2.
91+
92+
- Better support for union types and enums: #530, #535, #561, #570
93+
- Various bug and interface fixes: #532, #575, #564
94+
- GraphQL v15 required: #542
95+
- Lots of codebase improvements, more strict typing: #548
96+
97+
A special thanks to @rusted-love and @oprypkhantc for their contributions.
98+
99+
## 6.1.0
100+
101+
A shoutout to @bladl for his work on this release, improving the code for better typing and PHP 8.0 syntax updates!
102+
103+
### Breaking Changes
104+
105+
- #518 PSR-11 support now requires version 2
106+
- #508 Due to some of the code improvements, additional typing has been added to some interfaces/classes. For instance, `RootTypeMapperInterface::toGraphQLOutputType` and `RootTypeMapperInterface::toGraphQLInputType` now have the following signatures:
107+
108+
```php
109+
/**
110+
* @param (OutputType&GraphQLType)|null $subType
111+
*
112+
* @return OutputType&GraphQLType
113+
*/
114+
public function toGraphQLOutputType(
115+
Type $type,
116+
OutputType|null $subType,
117+
ReflectionMethod|ReflectionProperty $reflector,
118+
DocBlock $docBlockObj
119+
): OutputType;
120+
121+
/**
122+
* @param (InputType&GraphQLType)|null $subType
123+
*
124+
* @return InputType&GraphQLType
125+
*/
126+
public function toGraphQLInputType(
127+
Type $type,
128+
InputType|null $subType,
129+
string $argumentName,
130+
ReflectionMethod|ReflectionProperty $reflector,
131+
DocBlock $docBlockObj
132+
): InputType;
133+
```
134+
135+
### Improvements
136+
137+
- #510
138+
- #508
139+
140+
## 5.0.0
141+
142+
### Dependencies
143+
144+
- Upgraded to using version 14.9 of [webonyx/graphql-php](https://github.com/webonyx/graphql-php)
145+
146+
## 4.3.0
147+
148+
### Breaking change
149+
150+
- The method `setAnnotationCacheDir($directory)` has been removed from the `SchemaFactory`. The annotation
151+
cache will use your `Psr\SimpleCache\CacheInterface` compliant cache handler set through the `SchemaFactory`
152+
constructor.
153+
154+
### Minor changes
155+
156+
- Removed dependency for doctrine/cache and unified some of the cache layers following a PSR interface.
157+
- Cleaned up some of the documentation in an attempt to get things accurate with versioned releases.
158+
159+
## 4.2.0
160+
161+
### Breaking change
162+
163+
The method signature for `toGraphQLOutputType` and `toGraphQLInputType` have been changed to the following:
164+
165+
```php
166+
/**
167+
* @param \ReflectionMethod|\ReflectionProperty $reflector
168+
*/
169+
public function toGraphQLOutputType(Type $type, ?OutputType $subType, $reflector, DocBlock $docBlockObj): OutputType;
170+
171+
/**
172+
* @param \ReflectionMethod|\ReflectionProperty $reflector
173+
*/
174+
public function toGraphQLInputType(Type $type, ?InputType $subType, string $argumentName, $reflector, DocBlock $docBlockObj): InputType;
175+
```
176+
177+
### New features
178+
179+
- [@Input](annotations-reference.md#input-annotation) annotation is introduced as an alternative to `#[Factory]`. Now GraphQL input type can be created in the same manner as `#[Type]` in combination with `#[Field]` - [example](input-types.mdx#input-attribute).
180+
- New attributes has been added to [@Field](annotations-reference.md#field-annotation) annotation: `for`, `inputType` and `description`.
181+
- The following annotations now can be applied to class properties directly: `#[Field]`, `#[Logged]`, `#[Right]`, `@FailWith`, `@HideIfUnauthorized` and `#[Security]`.
182+
183+
## 4.1.0
184+
185+
### Breaking change
186+
187+
There is one breaking change introduced in the minor version (this was important to allow PHP 8 compatibility).
188+
189+
- The **ecodev/graphql-upload** package (used to get support for file uploads in GraphQL input types) is now a "recommended" dependency only.
190+
If you are using GraphQL file uploads, you need to add `ecodev/graphql-upload` to your `composer.json`.
191+
192+
### New features
193+
194+
- All annotations can now be accessed as PHP 8 attributes
195+
- The `@deprecated` annotation in your PHP code translates into deprecated fields in your GraphQL schema
196+
- You can now specify the GraphQL name of the Enum types you define
197+
- Added the possibility to inject pure Webonyx objects in GraphQLite schema
198+
199+
### Minor changes
200+
201+
- Migrated from `zend/diactoros` to `laminas/diactoros`
202+
- Making the annotation cache directory configurable
203+
204+
### Miscellaneous
205+
206+
- Migrated from Travis to Github actions
207+
208+
## 4.0.0
209+
210+
This is a complete refactoring from 3.x. While existing annotations are kept compatible, the internals have completely
211+
changed.
212+
213+
### New features
214+
215+
- You can directly [annotate a PHP interface with `#[Type]` to make it a GraphQL interface](inheritance-interfaces.mdx#mapping-interfaces)
216+
- You can autowire services in resolvers, thanks to the new `@Autowire` annotation
217+
- Added [user input validation](validation.mdx) (using the Symfony Validator or the Laravel validator or a custom `#[Assertion]` annotation
218+
- Improved security handling:
219+
- Unauthorized access to fields can now generate GraphQL errors (rather that schema errors in GraphQLite v3)
220+
- Added fine-grained security using the `#[Security]` annotation. A field can now be [marked accessible or not depending on the context](fine-grained-security.mdx).
221+
For instance, you can restrict access to the field "viewsCount" of the type `BlogPost` only for post that the current user wrote.
222+
- You can now inject the current logged user in any query / mutation / field using the `#[InjectUser]` annotation
223+
- Performance:
224+
- You can inject the [Webonyx query plan in a parameter from a resolver](query-plan.mdx)
225+
- You can use the [dataloader pattern to improve performance drastically via the "prefetchMethod" attribute](prefetch-method.mdx)
226+
- Customizable error handling has been added:
227+
- You can throw [many errors in one exception](error-handling.mdx#many-errors-for-one-exception) with `TheCodingMachine\GraphQLite\Exceptions\GraphQLAggregateException`
228+
- You can force input types using `@UseInputType(for="$id", inputType="ID!")`
229+
- You can extend an input types (just like you could extend an output type in v3) using [the new `#[Decorate]` annotation](extend-input-type.mdx)
230+
- In a factory, you can [exclude some optional parameters from the GraphQL schema](input-types#ignoring-some-parameters)
231+
232+
Many extension points have been added
233+
234+
- Added a "root type mapper" (useful to map scalar types to PHP types or to add custom annotations related to resolvers)
235+
- Added ["field middlewares"](field-middlewares.md) (useful to add middleware that modify the way GraphQL fields are handled)
236+
- Added a ["parameter type mapper"](argument-resolving.md) (useful to add customize parameter resolution or add custom annotations related to parameters)
237+
238+
New framework specific features:
239+
240+
### Symfony
241+
242+
- The Symfony bundle now provides a "login" and a "logout" mutation (and also a "me" query)
243+
244+
### Laravel
245+
246+
- [Native integration with the Laravel paginator](laravel-package-advanced.mdx#support-for-pagination) has been added
247+
248+
### Internals
249+
250+
- The `FieldsBuilder` class has been split in many different services (`FieldsBuilder`, `TypeHandler`, and a
251+
chain of *root type mappers*)
252+
- The `FieldsBuilderFactory` class has been completely removed.
253+
- Overall, there is not much in common internally between 4.x and 3.x. 4.x is much more flexible with many more hook points
254+
than 3.x. Try it out!
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
id: index
3+
title: GraphQLite
4+
slug: /
5+
sidebar_label: GraphQLite
6+
---
7+
8+
<p align="center">
9+
<img src="https://graphqlite.thecodingmachine.io/img/logo.svg" alt="GraphQLite logo" width="250" height="250" />
10+
</p>
11+
12+
13+
A PHP library that allows you to write your GraphQL queries in simple-to-write controllers.
14+
15+
## Features
16+
17+
* Create a complete GraphQL API by simply annotating your PHP classes
18+
* Framework agnostic, but Symfony, Laravel and PSR-15 bindings available!
19+
* Comes with batteries included: queries, mutations, subscriptions, mapping of arrays / iterators,
20+
file uploads, security, validation, extendable types and more!
21+
22+
## Basic example
23+
24+
First, declare a query in your controller:
25+
26+
```php
27+
class ProductController
28+
{
29+
#[Query]
30+
public function product(string $id): Product
31+
{
32+
// Some code that looks for a product and returns it.
33+
}
34+
}
35+
```
36+
37+
Then, annotate the `Product` class to declare what fields are exposed to the GraphQL API:
38+
39+
```php
40+
#[Type]
41+
class Product
42+
{
43+
#[Field]
44+
public function getName(): string
45+
{
46+
return $this->name;
47+
}
48+
// ...
49+
}
50+
```
51+
52+
That's it, you're good to go! Query and enjoy!
53+
54+
```graphql
55+
{
56+
product(id: 42) {
57+
name
58+
}
59+
}
60+
```

0 commit comments

Comments
 (0)