Skip to content

Commit 0278aff

Browse files
committed
Versioned docs for 6.0 release
1 parent 9078758 commit 0278aff

39 files changed

+7736
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
id: changelog
3+
title: Changelog
4+
sidebar_label: Changelog
5+
---
6+
7+
## 5.0.0
8+
9+
#### Dependencies:
10+
11+
- Upgraded to using version 14.9 of [webonyx/graphql-php](https://github.com/webonyx/graphql-php)
12+
13+
## 4.3.0
14+
15+
#### Breaking change:
16+
17+
- The method `setAnnotationCacheDir($directory)` has been removed from the `SchemaFactory`. The annotation
18+
cache will use your `Psr\SimpleCache\CacheInterface` compliant cache handler set through the `SchemaFactory`
19+
constructor.
20+
21+
#### Minor changes:
22+
23+
- Removed dependency for doctrine/cache and unified some of the cache layers following a PSR interface.
24+
- Cleaned up some of the documentation in an attempt to get things accurate with versioned releases.
25+
26+
## 4.2.0
27+
28+
#### Breaking change:
29+
30+
The method signature for `toGraphQLOutputType` and `toGraphQLInputType` have been changed to the following:
31+
32+
```php
33+
/**
34+
* @param \ReflectionMethod|\ReflectionProperty $reflector
35+
*/
36+
public function toGraphQLOutputType(Type $type, ?OutputType $subType, $reflector, DocBlock $docBlockObj): OutputType;
37+
38+
/**
39+
* @param \ReflectionMethod|\ReflectionProperty $reflector
40+
*/
41+
public function toGraphQLInputType(Type $type, ?InputType $subType, string $argumentName, $reflector, DocBlock $docBlockObj): InputType;
42+
```
43+
44+
#### New features:
45+
46+
- [@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).
47+
- New attributes has been added to [@Field](annotations-reference.md#field-annotation) annotation: `for`, `inputType` and `description`.
48+
- The following annotations now can be applied to class properties directly: `@Field`, `@Logged`, `@Right`, `@FailWith`, `@HideIfUnauthorized` and `@Security`.
49+
50+
## 4.1.0
51+
52+
#### Breaking change:
53+
54+
There is one breaking change introduced in the minor version (this was important to allow PHP 8 compatibility).
55+
56+
- The **ecodev/graphql-upload** package (used to get support for file uploads in GraphQL input types) is now a "recommended" dependency only.
57+
If you are using GraphQL file uploads, you need to add `ecodev/graphql-upload` to your `composer.json`.
58+
59+
#### New features:
60+
61+
- All annotations can now be accessed as PHP 8 attributes
62+
- The `@deprecated` annotation in your PHP code translates into deprecated fields in your GraphQL schema
63+
- You can now specify the GraphQL name of the Enum types you define
64+
- Added the possibility to inject pure Webonyx objects in GraphQLite schema
65+
66+
#### Minor changes:
67+
68+
- Migrated from `zend/diactoros` to `laminas/diactoros`
69+
- Making the annotation cache directory configurable
70+
71+
#### Miscellaneous:
72+
73+
- Migrated from Travis to Github actions
74+
75+
76+
## 4.0.0
77+
78+
This is a complete refactoring from 3.x. While existing annotations are kept compatible, the internals have completely
79+
changed.
80+
81+
#### New features:
82+
83+
- You can directly [annotate a PHP interface with `@Type` to make it a GraphQL interface](inheritance-interfaces.mdx#mapping-interfaces)
84+
- You can autowire services in resolvers, thanks to the new `@Autowire` annotation
85+
- Added [user input validation](validation.mdx) (using the Symfony Validator or the Laravel validator or a custom `@Assertion` annotation
86+
- Improved security handling:
87+
- Unauthorized access to fields can now generate GraphQL errors (rather that schema errors in GraphQLite v3)
88+
- 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).
89+
For instance, you can restrict access to the field "viewsCount" of the type `BlogPost` only for post that the current user wrote.
90+
- You can now inject the current logged user in any query / mutation / field using the `@InjectUser` annotation
91+
- Performance:
92+
- You can inject the [Webonyx query plan in a parameter from a resolver](query-plan.mdx)
93+
- You can use the [dataloader pattern to improve performance drastically via the "prefetchMethod" attribute](prefetch-method.mdx)
94+
- Customizable error handling has been added:
95+
- You can throw [many errors in one exception](error-handling.mdx#many-errors-for-one-exception) with `TheCodingMachine\GraphQLite\Exceptions\GraphQLAggregateException`
96+
- You can force input types using `@UseInputType(for="$id", inputType="ID!")`
97+
- 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)
98+
- In a factory, you can [exclude some optional parameters from the GraphQL schema](input-types#ignoring-some-parameters)
99+
100+
101+
Many extension points have been added
102+
103+
- Added a "root type mapper" (useful to map scalar types to PHP types or to add custom annotations related to resolvers)
104+
- Added ["field middlewares"](field-middlewares.md) (useful to add middleware that modify the way GraphQL fields are handled)
105+
- Added a ["parameter type mapper"](argument-resolving.md) (useful to add customize parameter resolution or add custom annotations related to parameters)
106+
107+
New framework specific features:
108+
109+
#### Symfony:
110+
111+
- The Symfony bundle now provides a "login" and a "logout" mutation (and also a "me" query)
112+
113+
#### Laravel:
114+
115+
- [Native integration with the Laravel paginator](laravel-package-advanced.mdx#support-for-pagination) has been added
116+
117+
#### Internals:
118+
119+
- The `FieldsBuilder` class has been split in many different services (`FieldsBuilder`, `TypeHandler`, and a
120+
chain of *root type mappers*)
121+
- The `FieldsBuilderFactory` class has been completely removed.
122+
- 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
123+
than 3.x. Try it out!
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
id: index
3+
title: GraphQLite
4+
slug: /
5+
sidebar_label: GraphQLite
6+
---
7+
8+
import Tabs from '@theme/Tabs';
9+
import TabItem from '@theme/TabItem';
10+
11+
<p align="center">
12+
<img src="https://graphqlite.thecodingmachine.io/img/logo.svg" alt="GraphQLite logo" width="250" height="250" />
13+
</p>
14+
15+
16+
A PHP library that allows you to write your GraphQL queries in simple-to-write controllers.
17+
18+
## Features
19+
20+
* Create a complete GraphQL API by simply annotating your PHP classes
21+
* Framework agnostic, but Symfony, Laravel and PSR-15 bindings available!
22+
* Comes with batteries included: queries, mutations, mapping of arrays / iterators, file uploads, security, validation, extendable types and more!
23+
24+
## Basic example
25+
26+
First, declare a query in your controller:
27+
28+
<Tabs
29+
defaultValue="php8"
30+
values={[
31+
{label: 'PHP 8', value: 'php8'},
32+
{label: 'PHP 7', value: 'php7'},
33+
]}>
34+
<TabItem value="php8">
35+
36+
```php
37+
class ProductController
38+
{
39+
#[Query]
40+
public function product(string $id): Product
41+
{
42+
// Some code that looks for a product and returns it.
43+
}
44+
}
45+
```
46+
47+
</TabItem>
48+
<TabItem value="php7">
49+
50+
```php
51+
class ProductController
52+
{
53+
/**
54+
* @Query()
55+
*/
56+
public function product(string $id): Product
57+
{
58+
// Some code that looks for a product and returns it.
59+
}
60+
}
61+
```
62+
63+
</TabItem>
64+
</Tabs>
65+
66+
Then, annotate the `Product` class to declare what fields are exposed to the GraphQL API:
67+
68+
<Tabs
69+
defaultValue="php8"
70+
values={[
71+
{label: 'PHP 8', value: 'php8'},
72+
{label: 'PHP 7', value: 'php7'},
73+
]}>
74+
<TabItem value="php8">
75+
76+
```php
77+
#[Type]
78+
class Product
79+
{
80+
#[Field]
81+
public function getName(): string
82+
{
83+
return $this->name;
84+
}
85+
// ...
86+
}
87+
```
88+
89+
</TabItem>
90+
<TabItem value="php7">
91+
92+
```php
93+
/**
94+
* @Type()
95+
*/
96+
class Product
97+
{
98+
/**
99+
* @Field()
100+
*/
101+
public function getName(): string
102+
{
103+
return $this->name;
104+
}
105+
// ...
106+
}
107+
```
108+
109+
</TabItem>
110+
</Tabs>
111+
112+
That's it, you're good to go! Query and enjoy!
113+
114+
```graphql
115+
{
116+
product(id: 42) {
117+
name
118+
}
119+
}
120+
```

0 commit comments

Comments
 (0)