diff --git a/README.md b/README.md index e0e37351fd..1cd7e01026 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ -[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/graphql-controllers/v/stable)](https://packagist.org/packages/thecodingmachine/graphql-controllers) -[![Total Downloads](https://poser.pugx.org/thecodingmachine/graphql-controllers/downloads)](https://packagist.org/packages/thecodingmachine/graphql-controllers) -[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/graphql-controllers/v/unstable)](https://packagist.org/packages/thecodingmachine/graphql-controllers) -[![License](https://poser.pugx.org/thecodingmachine/graphql-controllers/license)](https://packagist.org/packages/thecodingmachine/graphql-controllers) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/graphql-controllers/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/thecodingmachine/graphql-controllers/?branch=master) -[![Build Status](https://travis-ci.org/thecodingmachine/graphql-controllers.svg?branch=master)](https://travis-ci.org/thecodingmachine/graphql-controllers) -[![Coverage Status](https://coveralls.io/repos/thecodingmachine/graphql-controllers/badge.svg?branch=master&service=github)](https://coveralls.io/github/thecodingmachine/graphql-controllers?branch=master) +[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/graphqlite/v/stable)](https://packagist.org/packages/thecodingmachine/graphqlite) +[![Total Downloads](https://poser.pugx.org/thecodingmachine/graphqlite/downloads)](https://packagist.org/packages/thecodingmachine/graphqlite) +[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/graphqlite/v/unstable)](https://packagist.org/packages/thecodingmachine/graphqlite) +[![License](https://poser.pugx.org/thecodingmachine/graphqlite/license)](https://packagist.org/packages/thecodingmachine/graphqlite) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/graphqlite/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/thecodingmachine/graphqlite/?branch=master) +[![Build Status](https://travis-ci.org/thecodingmachine/graphqlite.svg?branch=master)](https://travis-ci.org/thecodingmachine/graphqlite) +[![Coverage Status](https://coveralls.io/repos/thecodingmachine/graphqlite/badge.svg?branch=master&service=github)](https://coveralls.io/github/thecodingmachine/graphqlite?branch=master) -# DEPRECATED. -# This library has moved to https://github.com/thecodingmachine/graphqlite - -GraphQL controllers -=================== +GraphQLite +========== A utility library on top of `webonyx/graphql-php` library. diff --git a/composer.json b/composer.json index fd084060aa..823055851c 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "thecodingmachine/graphql-controllers", + "name": "thecodingmachine/graphqlite", "description": "Write your GraphQL queries in simple to write controllers (using webonix/graphql-php).", "license": "MIT", "type": "library", @@ -35,12 +35,12 @@ }, "autoload": { "psr-4": { - "TheCodingMachine\\GraphQL\\Controllers\\": "src/" + "TheCodingMachine\\GraphQLite\\": "src/" } }, "autoload-dev": { "psr-4": { - "TheCodingMachine\\GraphQL\\Controllers\\": "tests/" + "TheCodingMachine\\GraphQLite\\": "tests/" } }, "scripts": { diff --git a/docs/authentication_authorization.md b/docs/authentication_authorization.md index c19379cccb..268b1c3c85 100644 --- a/docs/authentication_authorization.md +++ b/docs/authentication_authorization.md @@ -7,22 +7,22 @@ sidebar_label: Authentication and authorization You might not want to expose your GraphQL API to anyone. Or you might want to keep some queries / mutations or fields reserved to some users. -GraphQL-Controllers offers some control over what a user can do with your API based on authentication (whether the user +GraphQLite offers some control over what a user can do with your API based on authentication (whether the user is logged or not) or authorization (what rights the user have). -
Heads up! GraphQL-Controllers does not handle authentication or -authorization. It is up to you (or your framework) to handle that. [GraphQL-Controllers plugs into your framework +
Heads up! GraphQLite does not handle authentication or +authorization. It is up to you (or your framework) to handle that. [GraphQLite plugs into your framework to fetch whether you are authenticated or not and the list of your rights.](#connectframework)
## The @Logged and @Right annotations -GraphQL-Controllers exposes 2 annotations (`@Logged` and `@Right`) that you can use to restrict access to a resource. +GraphQLite exposes 2 annotations (`@Logged` and `@Right`) that you can use to restrict access to a resource. ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\Query; -use TheCodingMachine\GraphQL\Controllers\Annotations\Logged; -use TheCodingMachine\GraphQL\Controllers\Annotations\Right; +use TheCodingMachine\GraphQLite\Annotations\Query; +use TheCodingMachine\GraphQLite\Annotations\Logged; +use TheCodingMachine\GraphQLite\Annotations\Right; class UserController { @@ -90,9 +90,9 @@ You can therefore decide in a GraphQL type who can see what: ```php namespace App\Entities; -use TheCodingMachine\GraphQL\Controllers\Annotations\Field; -use TheCodingMachine\GraphQL\Controllers\Annotations\Type; -use TheCodingMachine\GraphQL\Controllers\Annotations\Right; +use TheCodingMachine\GraphQLite\Annotations\Field; +use TheCodingMachine\GraphQLite\Annotations\Type; +use TheCodingMachine\GraphQLite\Annotations\Right; /** * @Type() @@ -113,20 +113,20 @@ class Product ``` -## Connecting GraphQL-Controllers to your framework's security module +## Connecting GraphQLite to your framework's security module -GraphQL-Controllers needs to know if a user is logged or not, and what rights it has. +GraphQLite needs to know if a user is logged or not, and what rights it has. But this is specific of the framework you use. -To plug GraphQL-Controllers to your framework's security, you will have to provide 2 classes implementing the -`TheCodingMachine\GraphQL\Controllers\Security\AuthenticationServiceInterface` -and the `TheCodingMachine\GraphQL\Controllers\Security\AuthorizationServiceInterface`. +To plug GraphQLite to your framework's security, you will have to provide 2 classes implementing the +`TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface` +and the `TheCodingMachine\GraphQLite\Security\AuthorizationServiceInterface`. -
Symfony users: The GraphQL-Controllers bundle comes with the classes linking -GraphQL-Controllers to the security bundle. So you don't have to do anything. +
Symfony users: The GraphQLite bundle comes with the classes linking +GraphQLite to the security bundle. So you don't have to do anything.
-These 2 interfaces act as adapters between GraphQL-Controllers and your framework: +These 2 interfaces act as adapters between GraphQLite and your framework: ```php interface AuthenticationServiceInterface diff --git a/docs/custom_output_types.md b/docs/custom_output_types.md index 2f821c4cb7..88c82223ea 100644 --- a/docs/custom_output_types.md +++ b/docs/custom_output_types.md @@ -6,7 +6,7 @@ sidebar_label: Custom output types ## Why do I need this? -In some special cases, you want to override the GraphQL return type that is attributed by default by GraphQL-Controllers. +In some special cases, you want to override the GraphQL return type that is attributed by default by GraphQLite. Here is a sample: @@ -26,7 +26,7 @@ class ProductType } ``` -In the example above, GraphQL-Controllers will generate a GraphQL schema with a field "id" of type "string". +In the example above, GraphQLite will generate a GraphQL schema with a field "id" of type "string". ```graphql type Product { @@ -34,10 +34,10 @@ type Product { } ``` -GraphQL comes with an "ID" scalar type. But PHP has no such type. So GraphQL-Controllers does not know when a variable +GraphQL comes with an "ID" scalar type. But PHP has no such type. So GraphQLite does not know when a variable is an ID or not. -You can help GraphQL-Controllers by manually specifying the output type to use: +You can help GraphQLite by manually specifying the output type to use: ```php /** @@ -58,7 +58,7 @@ You can use the **outputType** attribute in the following annotations: ## Registering a custom output type (advanced) -If you have special needs, you can design your own output type. GraphQL-Controllers runs on top of webonyx/graphql. +If you have special needs, you can design your own output type. GraphQLite runs on top of webonyx/graphql. In order to create a custom output type, you need to: diff --git a/docs/extend_type.md b/docs/extend_type.md index f970302faa..ff01f34756 100644 --- a/docs/extend_type.md +++ b/docs/extend_type.md @@ -52,8 +52,8 @@ $name = $translationService->getProductName($productId, $language); Using `@ExtendType`, you can add an additional `name` field to your product: ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\ExtendType; -use TheCodingMachine\GraphQL\Controllers\Annotations\Field; +use TheCodingMachine\GraphQLite\Annotations\ExtendType; +use TheCodingMachine\GraphQLite\Annotations\Field; use App\Entities\Product; /** @@ -86,7 +86,7 @@ Let's break this sample: */ ``` -With the `@ExtendType` annotation, we tell GraphQL-Controllers that we want to add fields in the GraphQL type mapped to +With the `@ExtendType` annotation, we tell GraphQLite that we want to add fields in the GraphQL type mapped to the `Product` PHP class. ```php @@ -104,7 +104,7 @@ class ProductType ``` -- The `ProductType` class must be in the types namespace. You configured this namespace when you installed GraphQL-Controllers. +- The `ProductType` class must be in the types namespace. You configured this namespace when you installed GraphQLite. - The `ProductType` class is actually a **service**. You can therefore inject dependencies in it (like the `$translationService` in this example)
Heads up! The ProductType class must exist in the container of your diff --git a/docs/external_type_declaration.md b/docs/external_type_declaration.md index 7c9e6f3e93..af7f9e70ea 100644 --- a/docs/external_type_declaration.md +++ b/docs/external_type_declaration.md @@ -25,13 +25,13 @@ For instance: - You are doing domain-drive design and don't want to clutter your domain object with annotations from the view layer - ... -Hopefully, GraphQL-Controllers lets you declare a type without touching the targeted class. +Hopefully, GraphQLite lets you declare a type without touching the targeted class. Actually, you can use the `@Type` annotation on a service (just like the [@ExtendType annotation](extend_type.md)): ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\Type; -use TheCodingMachine\GraphQL\Controllers\Annotations\Field; +use TheCodingMachine\GraphQLite\Annotations\Type; +use TheCodingMachine\GraphQLite\Annotations\Field; use App\Entities\Product; /** @@ -64,7 +64,7 @@ Let's break this sample: */ ``` -With the "class" attribute of the `@Type` annotation, we tell GraphQL-Controllers that we want to create a GraphQL type +With the "class" attribute of the `@Type` annotation, we tell GraphQLite that we want to create a GraphQL type mapped to the `Product` PHP class. ```php @@ -82,7 +82,7 @@ class ProductType } ``` -- The `ProductType` class must be in the types namespace. You configured this namespace when you installed GraphQL-Controllers. +- The `ProductType` class must be in the types namespace. You configured this namespace when you installed GraphQLite. - The `ProductType` class is actually a **service**. You can therefore inject dependencies in it (like the `$translationService` in this example)
Heads up! The ProductType class must exist in the container of your @@ -138,11 +138,11 @@ class ProductType This is a lot of boilerplate code. -GraphQL-Controllers provides a shortcut for this: +GraphQLite provides a shortcut for this: ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\Type; -use TheCodingMachine\GraphQL\Controllers\Annotations\SourceField; +use TheCodingMachine\GraphQLite\Annotations\Type; +use TheCodingMachine\GraphQLite\Annotations\SourceField; use App\Entities\Product; /** @@ -155,17 +155,17 @@ class ProductType } ``` -By putting the `@SourceField` in the class docblock, you let GraphQL-controllers know that the type exposes the -`getName` method of the underlying `Product` object (GraphQL-controllers will look for methods named `name()`, `getName()` and `isName()`). +By putting the `@SourceField` in the class docblock, you let GraphQLite know that the type exposes the +`getName` method of the underlying `Product` object (GraphQLite will look for methods named `name()`, `getName()` and `isName()`). ### Managing rights You can also check for logged users or users with a specific right using the `logged` and `right` properties of the annotation: ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\Type; -use TheCodingMachine\GraphQL\Controllers\Annotations\SourceField; -use TheCodingMachine\GraphQL\Controllers\Annotations\Right; +use TheCodingMachine\GraphQLite\Annotations\Type; +use TheCodingMachine\GraphQLite\Annotations\SourceField; +use TheCodingMachine\GraphQLite\Annotations\Right; use App\Entities\Product; /** @@ -197,7 +197,7 @@ In some very particular cases, you might not know exactly the list of `@SourceFi If you need to decide the list of `@SourceField` at runtime, you can implement the `FromSourceFieldsInterface`: ```php -use TheCodingMachine\GraphQL\Controllers\FromSourceFieldsInterface; +use TheCodingMachine\GraphQLite\FromSourceFieldsInterface; /** * @Type(class=Product::class) diff --git a/docs/file_uploads.md b/docs/file_uploads.md index 0a15657196..1449df7ec6 100644 --- a/docs/file_uploads.md +++ b/docs/file_uploads.md @@ -7,7 +7,7 @@ sidebar_label: File uploads GraphQL does not support natively the notion of file uploads, but an extension to the GraphQL protocol was proposed to add support for [multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec). -GraphQL-Controllers supports this extension through the use of the [Ecodev/graphql-upload third party library](https://github.com/Ecodev/graphql-upload). +GraphQLite supports this extension through the use of the [Ecodev/graphql-upload third party library](https://github.com/Ecodev/graphql-upload). ## Installation diff --git a/docs/getting-started.md b/docs/getting-started.md index 43bec48f19..67aa58def4 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -4,7 +4,7 @@ title: Getting started sidebar_label: Getting Started --- -GraphQL-Controllers is a framework agnostic library. You can use it in any PHP projects as long a you know how to +GraphQLite is a framework agnostic library. You can use it in any PHP projects as long a you know how to inject services in your favorite framework's container. Currently, we provide an additional bundle to help you get started with Symfony. More frameworks will be supported soon. diff --git a/docs/inheritance.md b/docs/inheritance.md index 1aa384b122..a1daaeefdd 100644 --- a/docs/inheritance.md +++ b/docs/inheritance.md @@ -4,7 +4,7 @@ title: Inheritance and interfaces sidebar_label: Inheritance and interfaces --- -Some of your entities may extend other entities. GraphQL-controllers will do its best to represent this hierarchy of objects in GraphQL using interfaces. +Some of your entities may extend other entities. GraphQLite will do its best to represent this hierarchy of objects in GraphQL using interfaces. Let's say you have 2 classes: `Contact` and `User` (which extends `Contact`) @@ -54,7 +54,7 @@ contact { } ``` -Behind the scene, GraphQL-controllers will detect that the `Contact` class is extended by the `User` class. Because the +Behind the scene, GraphQLite will detect that the `Contact` class is extended by the `User` class. Because the class is extended, a GraphQL `ContactInterface` interface is created dynamically. You don't have to do anything. The GraphQL `User` type will automatically implement this `ContactInterface`. The interface contains all the fields available in the `Contact` type. @@ -76,7 +76,7 @@ type User implements ContactInterface { } ``` -
Right now, there is no way to explicitly declare a GraphQL interface using GraphQL-Controllers. -GraphQL-Controllers automatically declares interfaces when it sees an inheritance relationship between to classes that +
Right now, there is no way to explicitly declare a GraphQL interface using GraphQLite. +GraphQLite automatically declares interfaces when it sees an inheritance relationship between to classes that are GraphQL types.
diff --git a/docs/input_types.md b/docs/input_types.md index 23b72323d5..6af58b6aec 100644 --- a/docs/input_types.md +++ b/docs/input_types.md @@ -51,11 +51,11 @@ If you try to run this code, you will get the following error: CannotMapTypeException: cannot map class "Location" to a known GraphQL input type. Check your TypeMapper configuration. ``` -You are running into this error because GraphQL-Controllers does not know how to handle the `Location` object. +You are running into this error because GraphQLite does not know how to handle the `Location` object. In GraphQL, an object passed in parameter of a query or mutation (or any field) is called an **Input Type**. -In order to declare that type, in GraphQL-Controllers, we will declare a **Factory**. +In order to declare that type, in GraphQLite, we will declare a **Factory**. A **Factory** is a method that takes in parameter all the fields of the input type and return an object. diff --git a/docs/mutations.md b/docs/mutations.md index 5b65f36bbe..a0bb327f67 100644 --- a/docs/mutations.md +++ b/docs/mutations.md @@ -4,7 +4,7 @@ title: Writing mutations sidebar_label: Mutations --- -In GraphQL-Controllers, mutations are created [just like queries](my_first_query.md). +In GraphQLite, mutations are created [just like queries](my_first_query.md). To create a mutation, you annotate a method in a controller with the `@Mutation` annotation. @@ -13,7 +13,7 @@ Here is a sample of a "saveProduct" query: ```php namespace App\Controllers; -use TheCodingMachine\GraphQL\Controllers\Annotations\Mutation; +use TheCodingMachine\GraphQLite\Annotations\Mutation; class ProductController { diff --git a/docs/my_first_query.md b/docs/my_first_query.md index 4dd714db95..b1daa0967f 100644 --- a/docs/my_first_query.md +++ b/docs/my_first_query.md @@ -6,7 +6,7 @@ sidebar_label: My first query ## Creating a controller -In GraphQL-Controllers, GraphQL queries are creating by writing methods in "controller" classes. +In GraphQLite, GraphQL queries are creating by writing methods in "controller" classes. Each query method must be annotated with the `@Query` annotation. Here is a sample of a "hello world" query: @@ -14,7 +14,7 @@ Here is a sample of a "hello world" query: ```php namespace App\Controllers; -use TheCodingMachine\GraphQL\Controllers\Annotations\Query; +use TheCodingMachine\GraphQLite\Annotations\Query; class MyController { @@ -28,11 +28,11 @@ class MyController } ``` -- The `MyController` class does not need to extend any base class. For GraphQL-Controllers, a controller can be any +- The `MyController` class does not need to extend any base class. For GraphQLite, a controller can be any class. - The query method is annotated with a `@Query` annotation - The `MyController` class must be in the controllers namespace. You configured this namespace when you installed -GraphQL-Controllers. By default, in Symfony, the controllers namespace is `App\Controller`. +GraphQLite. By default, in Symfony, the controllers namespace is `App\Controller`.
Heads up! The MyController class must exist in the container of your application and the container identifier MUST be the fully qualified class name.

@@ -75,7 +75,7 @@ You can now perform a test query and get the answer: ![](../img/query1.png) -Internally, GraphQL-Controllers created a query and added it to its internal type system. +Internally, GraphQLite created a query and added it to its internal type system. If you are already used to GraphQL, you could represent this in "[Type language](https://graphql.org/learn/schema/#type-language)" like this: @@ -86,11 +86,11 @@ Type Query { } ``` -But with GraphQL-Controllers you don't need to use the *Type language* at all. The philosophy of GraphQL-Controllers -is that you do PHP code, you put annotations and GraphQL-Controllers is creating the GraphQL types for you. That means +But with GraphQLite you don't need to use the *Type language* at all. The philosophy of GraphQLite +is that you do PHP code, you put annotations and GraphQLite is creating the GraphQL types for you. That means less boilerplate code! -Internally, GraphQL-Controllers will do the mapping between PHP types and GraphQL types. +Internally, GraphQLite will do the mapping between PHP types and GraphQL types. ## Creating your first type @@ -99,7 +99,7 @@ So far, we simply declared a query. But we did not yet declare a type. Let's assume you want to return a product: ```php -use TheCodingMachine\GraphQL\Controllers\Annotations\Query; +use TheCodingMachine\GraphQLite\Annotations\Query; class ProductController { @@ -125,8 +125,8 @@ an annotation to this class. ```php namespace App\Entities; -use TheCodingMachine\GraphQL\Controllers\Annotations\Field; -use TheCodingMachine\GraphQL\Controllers\Annotations\Type; +use TheCodingMachine\GraphQLite\Annotations\Field; +use TheCodingMachine\GraphQLite\Annotations\Type; /** * @Type() @@ -153,11 +153,11 @@ class Product } ``` -The `@Type` annotation is used to inform GraphQL-Controllers that the `Product` class is a GraphQL type. +The `@Type` annotation is used to inform GraphQLite that the `Product` class is a GraphQL type. The `@Field` annotation is used to define the GraphQL fields. The `Product` class must be in the types namespace. You configured this namespace when you installed -GraphQL-Controllers. By default, in Symfony, the types namespace is any namespace starting with `App\` so you can +GraphQLite. By default, in Symfony, the types namespace is any namespace starting with `App\` so you can put a type anywhere in your application code.
Heads up! The @Field annotation must be put on a @@ -220,7 +220,7 @@ If you have never worked with annotations before, here are a few things you shou - Annotations are namespaced. You must not forget the "use" statement at the beginning of each file using an annotation. For instance: ```php - use TheCodingMachine\GraphQL\Controllers\Annotations\Query; + use TheCodingMachine\GraphQLite\Annotations\Query; ``` - Doctrine Annotations are hugely popular and used in many other libraries. They are widely supported in PHP IDEs. We highly recommend you add support for Doctrine annotations in your favorite IDE: diff --git a/docs/other_frameworks.md b/docs/other_frameworks.md index 1e570b8b16..e7617a3636 100644 --- a/docs/other_frameworks.md +++ b/docs/other_frameworks.md @@ -6,23 +6,23 @@ sidebar_label: Other frameworks / No framework If you are using Symfony 4+, checkout the [Symfony bundle](symfony-bundle.md). -GraphQL-Controllers requires: +GraphQLite requires: - A PSR-11 compatible container - A PSR-16 cache Additionally, you will need a way to route the HTTP requests to the underlying GraphQL library. -thecodingmachine/graphql-controllers uses internally [webonyx/graphql-php](http://webonyx.github.io/graphql-php/). +thecodingmachine/graphqlite uses internally [webonyx/graphql-php](http://webonyx.github.io/graphql-php/). This library plays well with PSR-7 requests and there is a PSR-15 middleware available. ## Generating a GraphQL schema. -GraphQL-Controllers purpose is to generate a [Webonyx GraphQL `Schema`](https://webonyx.github.io/graphql-php/type-system/schema/). +GraphQLite purpose is to generate a [Webonyx GraphQL `Schema`](https://webonyx.github.io/graphql-php/type-system/schema/). The easiest way to create such a schema is to use the `SchemaFactory` class. ```php -use TheCodingMachine\GraphQL\Controllers\SchemaFactory; +use TheCodingMachine\GraphQLite\SchemaFactory; // $cache is a PSR-16 compatible cache // $container is a PSR-11 compatible container @@ -44,7 +44,7 @@ The smallest working example using no framework is: setSchemaConfig($schemaConfig); ## A more advanced sample -In this sample, we will focus on getting a working version of GraphQL-Controllers using: +In this sample, we will focus on getting a working version of GraphQLite using: - [Zend Stratigility](https://docs.zendframework.com/zend-stratigility/) for the PSR-7 server - "phps-cans/psr7-middleware-graphql" to route PSR-7 requests to the GraphQL engine @@ -104,7 +104,7 @@ The choice of the libraries is really up to you. You can adapt it based on your } }, "require": { - "thecodingmachine/graphql-controllers": "^3", + "thecodingmachine/graphqlite": "^3", "phps-cans/psr7-middleware-graphql": "^0.2", "middlewares/payload": "^2.1", "zendframework/zend-diactoros": "^2", @@ -167,7 +167,7 @@ use PsCs\Middleware\Graphql\WebonyxGraphqlMiddleware; use Psr\Container\ContainerInterface; use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\ApcuCache; -use TheCodingMachine\GraphQL\Controllers\SchemaFactory; +use TheCodingMachine\GraphQLite\SchemaFactory; use Zend\Diactoros\ResponseFactory; use Zend\Diactoros\StreamFactory; use Zend\Stratigility\MiddlewarePipe; @@ -197,7 +197,7 @@ return new Picotainer([ return new ApcuCache(); }, Schema::class => function(ContainerInterface $container) { - // The magic happens here. We create a schema using GraphQL-Controllers SchemaFactory + // The magic happens here. We create a schema using GraphQLite SchemaFactory $factory = new SchemaFactory($container->get(CacheInterface::class), $container); $factory->addControllerNamespace('App\\Controllers\\'); $factory->addTypeNamespace('App\\'); @@ -207,7 +207,7 @@ return new Picotainer([ ``` Now, we need to add a first query. To do this, we create a controller. -The application will look into the 'App\\Controllers' namespace for GraphQL controllers. It assumes that the +The application will look into the 'App\\Controllers' namespace for GraphQLite controllers. It assumes that the container contains an entry whose name is the fully qualified class name of the container. @@ -215,7 +215,7 @@ container contains an entry whose name is the fully qualified class name of the ```php namespace App\Controllers; -use TheCodingMachine\GraphQL\Controllers\Annotations\Query; +use TheCodingMachine\GraphQLite\Annotations\Query; class MyController { diff --git a/docs/pagination.md b/docs/pagination.md index 4193a64acb..17143ecbdf 100644 --- a/docs/pagination.md +++ b/docs/pagination.md @@ -6,7 +6,7 @@ sidebar_label: Pagination It is quite common to have to paginate over large result sets. -GraphQL-Controllers offers a simple way to do that using [Porpaginas](https://github.com/beberlei/porpaginas). +GraphQLite offers a simple way to do that using [Porpaginas](https://github.com/beberlei/porpaginas). Porpaginas is a set of PHP interfaces that can be implemented by result iterators. It comes with a native support for PHP arrays, Doctrine and [TDBM](https://thecodingmachine.github.io/tdbm/doc/limit_offset_resultset.html). @@ -35,7 +35,7 @@ class MyController Notice that: - the method return type MUST BE `Porpaginas\Result` or a class implementing `Porpaginas\Result` -- you MUST add a `@return` statement to help GraphQL-Controllers find the type of the list +- you MUST add a `@return` statement to help GraphQLite find the type of the list Once this is done, you can paginate directly from your GraphQL query: diff --git a/docs/symfony-bundle.md b/docs/symfony-bundle.md index cdf36648b9..cda69c85f9 100644 --- a/docs/symfony-bundle.md +++ b/docs/symfony-bundle.md @@ -4,7 +4,7 @@ title: Getting started with Symfony sidebar_label: Symfony bundle --- -The GraphQL-Controllers bundle is compatible with Symfony 4+. +The GraphQLite bundle is compatible with Symfony 4+. From your Symfony 4+ project, run the following command: Applications that use Symfony Flex @@ -13,7 +13,7 @@ Applications that use Symfony Flex Open a command console, enter your project directory and execute: ```console -$ composer require thecodingmachine/graphql-controllers-bundle +$ composer require thecodingmachine/graphqlite-bundle ``` Applications that don't use Symfony Flex @@ -25,7 +25,7 @@ Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle: ```console -$ composer require thecodingmachine/graphql-controllers-bundle +$ composer require thecodingmachine/graphqlite-bundle ``` This command requires you to have Composer installed globally, as explained @@ -48,7 +48,7 @@ class AppKernel extends Kernel { $bundles = array( // ... - new TheCodingMachine\GraphQL\Controllers\Bundle\GraphQLControllersBundle, + new TheCodingMachine\GraphQLite\Bundle\GraphQLiteBundle, ); // ... @@ -60,10 +60,10 @@ class AppKernel extends Kernel ### Step 3 (optional): Create a configuration file -Create a configuration file in `config/packages/graphql_controllers.yaml`: +Create a configuration file in `config/packages/graphqlite.yaml`: ```yaml -graphql_controllers: +graphqlite: namespace: controllers: App\Controller\ types: @@ -81,18 +81,18 @@ graphql_controllers: RETHROW_UNSAFE_EXCEPTIONS: true ``` -The 'graphqlcontrollers.namespace.controllers' configuration variable is the namespace(s) that will store your GraphQL controllers. -The 'graphqlcontrollers.namespace.types' configuration variable is the namespace(s) that will store your GraphQL types and factories. +The 'graphqlite.namespace.controllers' configuration variable is the namespace(s) that will store your GraphQLite controllers. +The 'graphqlite.namespace.types' configuration variable is the namespace(s) that will store your GraphQL types and factories. -For both 'graphqlcontrollers.namespace.controllers' and 'graphqlcontrollers.namespace.types', you can pass a string (the namespace to target) +For both 'graphqlite.namespace.controllers' and 'graphqlite.namespace.types', you can pass a string (the namespace to target) or an array of strings if you have several namespaces to track. ## Configure the bundle -Using `config/packages/graphql-controllers.yaml`, you can configure how exceptions will be handled. +Using `config/packages/graphqlite.yaml`, you can configure how exceptions will be handled. By default (with no configuration), the `RETHROW_UNSAFE_EXCEPTIONS` mode will be used: any exception will be propagated to Symfony, unless it implements the `GraphQL\Error\ClientAware` exception. The debug parameters (`INCLUDE_DEBUG_MESSAGE`, `INCLUDE_TRACE`, `RETHROW_INTERNAL_EXCEPTIONS` and `RETHROW_UNSAFE_EXCEPTIONS`), -are detailed in the [documentation of the Webonix GraphQL-PHP library that is used by "GraphQL-Controllers"](https://webonyx.github.io/graphql-php/error-handling/). +are detailed in the [documentation of the Webonix GraphQL-PHP library that is used by "GraphQLite"](https://webonyx.github.io/graphql-php/error-handling/). diff --git a/docs/type_mapping.md b/docs/type_mapping.md index 60fe942e8a..b9a5460193 100644 --- a/docs/type_mapping.md +++ b/docs/type_mapping.md @@ -4,9 +4,9 @@ title: Type mapping sidebar_label: Type mapping --- -The job of GraphQL-Controllers is to create GraphQL types from PHP types. +The job of GraphQLite is to create GraphQL types from PHP types. -Internally, GraphQL-Controllers uses a "type mapper". +Internally, GraphQLite uses a "type mapper". ## Mapping a PHP class to a GraphQL type @@ -63,7 +63,7 @@ You can learn more about [forcing output types in the "custom output types" docu ### Solution 2: use the "ID" class ```php -use TheCodingMachine\GraphQL\Controllers\Types\ID; +use TheCodingMachine\GraphQLite\Types\ID; /** * @Field @@ -77,7 +77,7 @@ public function getId(): ID Note that you can also use the "ID" class as an input type: ```php -use TheCodingMachine\GraphQL\Controllers\Types\ID; +use TheCodingMachine\GraphQLite\Types\ID; /** * @Mutation diff --git a/phpstan.neon b/phpstan.neon index 8301af1790..3a4424ab80 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ parameters: ignoreErrors: - "#PHPDoc tag \\@throws with type Psr\\\\Container\\\\ContainerExceptionInterface is not subtype of Throwable#" - - "#Property TheCodingMachine\\\\GraphQL\\\\Controllers\\\\Types\\\\ResolvableInputObjectType::$resolve \\(array&callable\\) does not accept array#" + - "#Property TheCodingMachine\\\\GraphQLite\\\\Types\\\\ResolvableInputObjectType::$resolve \\(array&callable\\) does not accept array#" - "#Variable \\$failWith might not be defined#" #includes: # - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f07d1ebf62..b4cddd9735 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ bootstrap="vendor/autoload.php" > - + ./tests/ diff --git a/src/AggregateControllerQueryProvider.php b/src/AggregateControllerQueryProvider.php index e62f68e725..2c43ee8bf4 100644 --- a/src/AggregateControllerQueryProvider.php +++ b/src/AggregateControllerQueryProvider.php @@ -1,10 +1,10 @@ class === null) { - throw new \RuntimeException('Empty class for @Type annotation. You MUST create the Type annotation object using the GraphQL-Controllers AnnotationReader'); + throw new \RuntimeException('Empty class for @Type annotation. You MUST create the Type annotation object using the GraphQLite AnnotationReader'); } return $this->class; } diff --git a/src/Containers/BasicAutoWiringContainer.php b/src/Containers/BasicAutoWiringContainer.php index edf0ec78de..5e7e5ccae4 100644 --- a/src/Containers/BasicAutoWiringContainer.php +++ b/src/Containers/BasicAutoWiringContainer.php @@ -1,7 +1,7 @@ [ 'type' => Type::string(), - 'description' => 'A placeholder query used by thecodingmachine/graphql-controllers when there are no declared queries.', + 'description' => 'A placeholder query used by thecodingmachine/graphqlite when there are no declared queries.', 'resolve' => function () { return 'This is a placeholder query. Please create a query using the @Query annotation.'; } @@ -50,7 +50,7 @@ public function __construct(QueryProviderInterface $queryProvider, RecursiveType return [ 'dummyMutation' => [ 'type' => Type::string(), - 'description' => 'A placeholder query used by thecodingmachine/graphql-controllers when there are no declared mutations.', + 'description' => 'A placeholder query used by thecodingmachine/graphqlite when there are no declared mutations.', 'resolve' => function () { return 'This is a placeholder mutation. Please create a mutation using the @Mutation annotation.'; } diff --git a/src/SchemaFactory.php b/src/SchemaFactory.php index 16f373cede..ee49b67aaf 100644 --- a/src/SchemaFactory.php +++ b/src/SchemaFactory.php @@ -1,7 +1,7 @@ expectException(AnnotationException::class); $annotationReader->getTypeAnnotation(new ReflectionClass(ClassWithInvalidClassAnnotation::class)); @@ -81,7 +81,7 @@ public function testGetAnnotationsLaxModeWithSmellyAnnotation() public function testGetAnnotationsLaxModeWithBadAnnotationAndStrictNamespace() { - $annotationReader = new AnnotationReader(new DoctrineAnnotationReader(), AnnotationReader::LAX_MODE, ['TheCodingMachine\\GraphQL\\Controllers\\Fixtures']); + $annotationReader = new AnnotationReader(new DoctrineAnnotationReader(), AnnotationReader::LAX_MODE, ['TheCodingMachine\\GraphQLite\\Fixtures']); $this->expectException(AnnotationException::class); $annotationReader->getClassAnnotations(new ReflectionClass(ClassWithInvalidClassAnnotation::class), Type::class); @@ -116,7 +116,7 @@ public function testExtendAnnotationException() $annotationReader = new AnnotationReader(new DoctrineAnnotationReader(), AnnotationReader::STRICT_MODE, []); $this->expectException(ClassNotFoundException::class); - $this->expectExceptionMessage("Could not autoload class 'foo' defined in @ExtendType annotation of class 'TheCodingMachine\GraphQL\Controllers\Fixtures\Annotations\ClassWithInvalidExtendTypeAnnotation'"); + $this->expectExceptionMessage("Could not autoload class 'foo' defined in @ExtendType annotation of class 'TheCodingMachine\GraphQLite\Fixtures\Annotations\ClassWithInvalidExtendTypeAnnotation'"); $annotationReader->getExtendTypeAnnotation(new ReflectionClass(ClassWithInvalidExtendTypeAnnotation::class)); } } diff --git a/tests/Annotations/ExtendTypeTest.php b/tests/Annotations/ExtendTypeTest.php index 0a081438f3..ba42b735f9 100644 --- a/tests/Annotations/ExtendTypeTest.php +++ b/tests/Annotations/ExtendTypeTest.php @@ -1,6 +1,6 @@ expectException(RuntimeException::class); - $this->expectExceptionMessage('Empty class for @Type annotation. You MUST create the Type annotation object using the GraphQL-Controllers AnnotationReader'); + $this->expectExceptionMessage('Empty class for @Type annotation. You MUST create the Type annotation object using the GraphQLite AnnotationReader'); $type->getClass(); } } diff --git a/tests/Containers/BasicAutoWiringContainerTest.php b/tests/Containers/BasicAutoWiringContainerTest.php index a30c8b57df..b94cde5414 100644 --- a/tests/Containers/BasicAutoWiringContainerTest.php +++ b/tests/Containers/BasicAutoWiringContainerTest.php @@ -1,13 +1,13 @@ buildFieldsBuilder(); $this->expectException(FieldNotFoundException::class); - $this->expectExceptionMessage("There is an issue with a @SourceField annotation in class \"TheCodingMachine\GraphQL\Controllers\Fixtures\TestTypeMissingField\": Could not find a getter or a isser for field \"notExists\". Looked for: \"TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject::notExists()\", \"TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject::getNotExists()\", \"TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject::isNotExists()"); + $this->expectExceptionMessage("There is an issue with a @SourceField annotation in class \"TheCodingMachine\GraphQLite\Fixtures\TestTypeMissingField\": Could not find a getter or a isser for field \"notExists\". Looked for: \"TheCodingMachine\GraphQLite\Fixtures\TestObject::notExists()\", \"TheCodingMachine\GraphQLite\Fixtures\TestObject::getNotExists()\", \"TheCodingMachine\GraphQLite\Fixtures\TestObject::isNotExists()"); $queryProvider->getFields(new TestTypeMissingField(), true); } @@ -255,7 +255,7 @@ public function testSourceFieldHasMissingReturnType() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(TypeMappingException::class); - $this->expectExceptionMessage("Return type in TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\TestObjectMissingReturnType::getTest is missing a type-hint (or type-hinted to \"mixed\"). Please provide a better type-hint."); + $this->expectExceptionMessage("Return type in TheCodingMachine\\GraphQLite\\Fixtures\\TestObjectMissingReturnType::getTest is missing a type-hint (or type-hinted to \"mixed\"). Please provide a better type-hint."); $queryProvider->getFields(new TestTypeMissingReturnType(), true); } @@ -356,7 +356,7 @@ public function testQueryProviderWithInvalidInputType() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(CannotMapTypeException::class); - $this->expectExceptionMessage('For parameter $foo, in TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithInvalidInputType::test, cannot map class "Exception" to a known GraphQL input type. Check your TypeMapper configuration.'); + $this->expectExceptionMessage('For parameter $foo, in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithInvalidInputType::test, cannot map class "Exception" to a known GraphQL input type. Check your TypeMapper configuration.'); $queryProvider->getQueries($controller); } @@ -367,7 +367,7 @@ public function testQueryProviderWithInvalidReturnType() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(CannotMapTypeException::class); - $this->expectExceptionMessage('For return type of TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithInvalidReturnType::test, cannot map class "Exception" to a known GraphQL type. Check your TypeMapper configuration.'); + $this->expectExceptionMessage('For return type of TheCodingMachine\GraphQLite\Fixtures\TestControllerWithInvalidReturnType::test, cannot map class "Exception" to a known GraphQL type. Check your TypeMapper configuration.'); $queryProvider->getQueries($controller); } @@ -378,7 +378,7 @@ public function testQueryProviderWithIterableReturnType() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(TypeMappingException::class); - $this->expectExceptionMessage('Return type in TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithIterableReturnType::test is type-hinted to "\ArrayObject", which is iterable. Please provide an additional @param in the PHPDoc block to further specify the type. For instance: @return \ArrayObject|User[]'); + $this->expectExceptionMessage('Return type in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithIterableReturnType::test is type-hinted to "\ArrayObject", which is iterable. Please provide an additional @param in the PHPDoc block to further specify the type. For instance: @return \ArrayObject|User[]'); $queryProvider->getQueries($controller); } @@ -389,7 +389,7 @@ public function testQueryProviderWithArrayReturnType() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(TypeMappingException::class); - $this->expectExceptionMessage('Return type in TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithArrayReturnType::test is type-hinted to array. Please provide an additional @return in the PHPDoc block to further specify the type of the array. For instance: @return string[]'); + $this->expectExceptionMessage('Return type in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithArrayReturnType::test is type-hinted to array. Please provide an additional @return in the PHPDoc block to further specify the type of the array. For instance: @return string[]'); $queryProvider->getQueries($controller); } @@ -400,7 +400,7 @@ public function testQueryProviderWithArrayParams() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(TypeMappingException::class); - $this->expectExceptionMessage('Parameter $params in TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithArrayParam::test is type-hinted to array. Please provide an additional @param in the PHPDoc block to further specify the type of the array. For instance: @param string[] $params.'); + $this->expectExceptionMessage('Parameter $params in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithArrayParam::test is type-hinted to array. Please provide an additional @param in the PHPDoc block to further specify the type of the array. For instance: @param string[] $params.'); $queryProvider->getQueries($controller); } @@ -411,7 +411,7 @@ public function testQueryProviderWithIterableParams() $queryProvider = $this->buildFieldsBuilder(); $this->expectException(TypeMappingException::class); - $this->expectExceptionMessage('Parameter $params in TheCodingMachine\GraphQL\Controllers\Fixtures\TestControllerWithIterableParam::test is type-hinted to "\ArrayObject", which is iterable. Please provide an additional @param in the PHPDoc block to further specify the type. For instance: @param \ArrayObject|User[] $params.'); + $this->expectExceptionMessage('Parameter $params in TheCodingMachine\GraphQLite\Fixtures\TestControllerWithIterableParam::test is type-hinted to "\ArrayObject", which is iterable. Please provide an additional @param in the PHPDoc block to further specify the type. For instance: @param \ArrayObject|User[] $params.'); $queryProvider->getQueries($controller); } diff --git a/tests/Fixtures/Annotations/ClassWithInvalidClassAnnotation.php b/tests/Fixtures/Annotations/ClassWithInvalidClassAnnotation.php index bcaedd4965..3178431c7a 100644 --- a/tests/Fixtures/Annotations/ClassWithInvalidClassAnnotation.php +++ b/tests/Fixtures/Annotations/ClassWithInvalidClassAnnotation.php @@ -1,7 +1,7 @@ getControllerQueryProviderFactory(), $this->getTypeMapper(), $container, new NullCache()); + $globControllerQueryProvider = new GlobControllerQueryProvider('TheCodingMachine\\GraphQLite', $this->getControllerQueryProviderFactory(), $this->getTypeMapper(), $container, new NullCache()); $queries = $globControllerQueryProvider->getQueries(); $this->assertCount(6, $queries); diff --git a/tests/Hydrators/FactoryHydratorTest.php b/tests/Hydrators/FactoryHydratorTest.php index f199cd6e78..8f016c9e8e 100644 --- a/tests/Hydrators/FactoryHydratorTest.php +++ b/tests/Hydrators/FactoryHydratorTest.php @@ -1,11 +1,11 @@ getInputTypeUtils(); $this->expectException(MissingTypeHintException::class); - $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryNoReturnType" must have a return type.'); + $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQLite\\InputTypeUtilsTest::factoryNoReturnType" must have a return type.'); $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryNoReturnType')); } @@ -22,7 +22,7 @@ public function testInvalidReturnType() $inputTypeGenerator = $this->getInputTypeUtils(); $this->expectException(MissingTypeHintException::class); - $this->expectExceptionMessage('The return type of factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryStringReturnType" must be an object, "string" passed instead.'); + $this->expectExceptionMessage('The return type of factory "TheCodingMachine\\GraphQLite\\InputTypeUtilsTest::factoryStringReturnType" must be an object, "string" passed instead.'); $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryStringReturnType')); } @@ -31,7 +31,7 @@ public function testNullableReturnType() $inputTypeGenerator = $this->getInputTypeUtils(); $this->expectException(MissingTypeHintException::class); - $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQL\\Controllers\\InputTypeUtilsTest::factoryNullableReturnType" must have a non nullable return type.'); + $this->expectExceptionMessage('Factory "TheCodingMachine\\GraphQLite\\InputTypeUtilsTest::factoryNullableReturnType" must have a non nullable return type.'); $inputTypeGenerator->getInputTypeNameAndClassName(new ReflectionMethod($this, 'factoryNullableReturnType')); } diff --git a/tests/Integration/EndToEndTest.php b/tests/Integration/EndToEndTest.php index ab1980ac79..3e51ba5450 100644 --- a/tests/Integration/EndToEndTest.php +++ b/tests/Integration/EndToEndTest.php @@ -1,6 +1,6 @@ get(QueryProviderInterface::class), $container->get(RecursiveTypeMapperInterface::class), $container->get(TypeResolver::class)); }, QueryProviderInterface::class => function(ContainerInterface $container) { - return new GlobControllerQueryProvider('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers', $container->get(FieldsBuilderFactory::class), + return new GlobControllerQueryProvider('TheCodingMachine\\GraphQLite\\Fixtures\\Integration\\Controllers', $container->get(FieldsBuilderFactory::class), $container->get(RecursiveTypeMapperInterface::class), $container->get(BasicAutoWiringContainer::class), new ArrayCache()); }, FieldsBuilderFactory::class => function(ContainerInterface $container) { @@ -103,7 +103,7 @@ public function setUp() ]); }, GlobTypeMapper::class => function(ContainerInterface $container) { - return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Types', + return new GlobTypeMapper('TheCodingMachine\\GraphQLite\\Fixtures\\Integration\\Types', $container->get(TypeGenerator::class), $container->get(InputTypeGenerator::class), $container->get(InputTypeUtils::class), @@ -114,7 +114,7 @@ public function setUp() ); }, GlobTypeMapper::class.'2' => function(ContainerInterface $container) { - return new GlobTypeMapper('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Models', + return new GlobTypeMapper('TheCodingMachine\\GraphQLite\\Fixtures\\Integration\\Models', $container->get(TypeGenerator::class), $container->get(InputTypeGenerator::class), $container->get(InputTypeUtils::class), diff --git a/tests/Mappers/CompositeTypeMapperTest.php b/tests/Mappers/CompositeTypeMapperTest.php index 4b56f3eb27..240dd44c87 100644 --- a/tests/Mappers/CompositeTypeMapperTest.php +++ b/tests/Mappers/CompositeTypeMapperTest.php @@ -1,17 +1,17 @@ getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $inputTypeGenerator, $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertSame([TestObject::class], $mapper->getSupportedClasses()); $this->assertTrue($mapper->canMapClassToType(TestObject::class)); @@ -43,7 +43,7 @@ public function testGlobTypeMapper() $this->assertFalse($mapper->canMapNameToType('NotExists')); // Again to test cache - $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertTrue($anotherMapperSameCache->canMapClassToType(TestObject::class)); $this->assertTrue($anotherMapperSameCache->canMapNameToType('Foo')); @@ -61,7 +61,7 @@ public function testGlobTypeMapperDuplicateTypesException() $typeGenerator = $this->getTypeGenerator(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\DuplicateTypes', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\DuplicateTypes', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); $this->expectException(DuplicateMappingException::class); $mapper->canMapClassToType(TestType::class); @@ -77,10 +77,10 @@ public function testGlobTypeMapperDuplicateInputTypesException() $typeGenerator = $this->getTypeGenerator(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\DuplicateInputTypes', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); $this->expectException(DuplicateMappingException::class); - $this->expectExceptionMessage('The class \'TheCodingMachine\GraphQL\Controllers\Fixtures\TestObject\' should be mapped to only one GraphQL Input type. Two methods are pointing via the @Factory annotation to this class: \'TheCodingMachine\GraphQL\Controllers\Fixtures\DuplicateInputTypes\TestFactory::myFactory\' and \'TheCodingMachine\GraphQL\Controllers\Fixtures\DuplicateInputTypes\TestFactory2::myFactory\''); + $this->expectExceptionMessage('The class \'TheCodingMachine\GraphQLite\Fixtures\TestObject\' should be mapped to only one GraphQL Input type. Two methods are pointing via the @Factory annotation to this class: \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory::myFactory\' and \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory2::myFactory\''); $mapper->canMapClassToInputType(TestObject::class); } @@ -94,10 +94,10 @@ public function testGlobTypeMapperClassNotFoundException() $typeGenerator = $this->getTypeGenerator(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\BadClassType', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\BadClassType', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); $this->expectException(ClassNotFoundException::class); - $this->expectExceptionMessage("Could not autoload class 'Foobar' defined in @Type annotation of class 'TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\BadClassType\\TestType'"); + $this->expectExceptionMessage("Could not autoload class 'Foobar' defined in @Type annotation of class 'TheCodingMachine\\GraphQLite\\Fixtures\\BadClassType\\TestType'"); $mapper->canMapClassToType(TestType::class); } @@ -111,7 +111,7 @@ public function testGlobTypeMapperNameNotFoundException() $typeGenerator = $this->getTypeGenerator(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), new NullCache()); $this->expectException(CannotMapTypeException::class); $mapper->mapNameToType('NotExists', $this->getTypeMapper()); @@ -132,7 +132,7 @@ public function testGlobTypeMapperInputType() $cache = new ArrayCache(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertTrue($mapper->canMapClassToInputType(TestObject::class)); @@ -141,7 +141,7 @@ public function testGlobTypeMapperInputType() $this->assertSame('TestObjectInput', $inputType->name); // Again to test cache - $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertTrue($anotherMapperSameCache->canMapClassToInputType(TestObject::class)); $this->assertSame('TestObjectInput', $anotherMapperSameCache->mapClassToInputType(TestObject::class, $this->getTypeMapper())->name); @@ -167,7 +167,7 @@ public function testGlobTypeMapperExtend() $cache = new ArrayCache(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $inputTypeGenerator, $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $inputTypeGenerator, $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $type = $mapper->mapClassToType(TestObject::class, null, $this->getTypeMapper()); @@ -178,7 +178,7 @@ public function testGlobTypeMapperExtend() $this->assertFalse($mapper->canExtendTypeForName('NotExists', $type, $this->getTypeMapper())); // Again to test cache - $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $anotherMapperSameCache = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertTrue($anotherMapperSameCache->canExtendTypeForClass(TestObject::class, $type, $this->getTypeMapper())); $this->assertTrue($anotherMapperSameCache->canExtendTypeForName('TestObject', $type, $this->getTypeMapper())); @@ -195,7 +195,7 @@ public function testEmptyGlobTypeMapper() $cache = new ArrayCache(); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Integration\Controllers', $typeGenerator, $inputTypeGenerator, $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Integration\Controllers', $typeGenerator, $inputTypeGenerator, $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $cache); $this->assertSame([], $mapper->getSupportedClasses()); } diff --git a/tests/Mappers/PorpaginasTypeMapperTest.php b/tests/Mappers/PorpaginasTypeMapperTest.php index b629c1948e..c5d8100596 100644 --- a/tests/Mappers/PorpaginasTypeMapperTest.php +++ b/tests/Mappers/PorpaginasTypeMapperTest.php @@ -1,13 +1,13 @@ getAnnotationReader(), $this->getControllerQueryProviderFactory(), $namingStrategy, $this->getTypeRegistry(), $this->getRegistry()); - $mapper = new GlobTypeMapper('TheCodingMachine\GraphQL\Controllers\Fixtures\Interfaces\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQL\Controllers\AnnotationReader(new AnnotationReader()), $namingStrategy, new NullCache()); + $mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\Interfaces\Types', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), $namingStrategy, new NullCache()); return new RecursiveTypeMapper($mapper, new NamingStrategy(), new ArrayCache(), $this->getTypeRegistry()); } @@ -150,9 +150,9 @@ public function testGetOutputTypes() $recursiveMapper = $this->getTypeMapper(); $outputTypes = $recursiveMapper->getOutputTypes(); - $this->assertArrayHasKey('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Interfaces\\ClassA', $outputTypes); - $this->assertArrayHasKey('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Interfaces\\ClassB', $outputTypes); - $this->assertArrayNotHasKey('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Interfaces\\ClassC', $outputTypes); + $this->assertArrayHasKey('TheCodingMachine\\GraphQLite\\Fixtures\\Interfaces\\ClassA', $outputTypes); + $this->assertArrayHasKey('TheCodingMachine\\GraphQLite\\Fixtures\\Interfaces\\ClassB', $outputTypes); + $this->assertArrayNotHasKey('TheCodingMachine\\GraphQLite\\Fixtures\\Interfaces\\ClassC', $outputTypes); } diff --git a/tests/Mappers/StaticTypeMapperTest.php b/tests/Mappers/StaticTypeMapperTest.php index e558276a0e..bf76c795e4 100644 --- a/tests/Mappers/StaticTypeMapperTest.php +++ b/tests/Mappers/StaticTypeMapperTest.php @@ -1,16 +1,16 @@ addControllerNamespace('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers'); - $factory->addTypeNamespace('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration'); + $factory->addControllerNamespace('TheCodingMachine\\GraphQLite\\Fixtures\\Integration\\Controllers'); + $factory->addTypeNamespace('TheCodingMachine\\GraphQLite\\Fixtures\\Integration'); $factory->addQueryProvider(new AggregateQueryProvider([])); $schema = $factory->createSchema(); @@ -40,8 +40,8 @@ public function testSetters(): void $factory = new SchemaFactory($cache, $container); - $factory->addControllerNamespace('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration\\Controllers'); - $factory->addTypeNamespace('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration'); + $factory->addControllerNamespace('TheCodingMachine\\GraphQLite\\Fixtures\\Integration\\Controllers'); + $factory->addTypeNamespace('TheCodingMachine\\GraphQLite\\Fixtures\\Integration'); $factory->setDoctrineAnnotationReader(new \Doctrine\Common\Annotations\AnnotationReader()) ->setHydrator(new FactoryHydrator()) ->setAuthenticationService(new VoidAuthenticationService()) @@ -72,7 +72,7 @@ public function testException2(): void $cache = new PhpFilesCache(); $factory = new SchemaFactory($cache, $container); - $factory->addTypeNamespace('TheCodingMachine\\GraphQL\\Controllers\\Fixtures\\Integration'); + $factory->addTypeNamespace('TheCodingMachine\\GraphQLite\\Fixtures\\Integration'); $this->expectException(GraphQLException::class); $factory->createSchema(); diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php index e3453ea341..e0e5932766 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -1,6 +1,6 @@ assertSame(true, $obj->isTestBool()); $this->expectException(GraphQLException::class); - $this->expectExceptionMessage("Expected argument 'string' was not provided in GraphQL input type 'InputObject' used in factory 'TheCodingMachine\GraphQL\Controllers\Fixtures\Types\TestFactory::myFactory()'"); + $this->expectExceptionMessage("Expected argument 'string' was not provided in GraphQL input type 'InputObject' used in factory 'TheCodingMachine\GraphQLite\Fixtures\Types\TestFactory::myFactory()'"); $inputType->resolve([]); } diff --git a/tests/Types/TypeResolverTest.php b/tests/Types/TypeResolverTest.php index a61056eac1..9d8c25b4e5 100644 --- a/tests/Types/TypeResolverTest.php +++ b/tests/Types/TypeResolverTest.php @@ -1,12 +1,12 @@
More
Blog - GitHub + GitHub Star + aria-label="Star thecodingmachine/graphqlite on GitHub">Star
diff --git a/website/pages/en/index.js b/website/pages/en/index.js index 6534385bb7..e23728a6f7 100755 --- a/website/pages/en/index.js +++ b/website/pages/en/index.js @@ -66,7 +66,7 @@ class HomeSplash extends React.Component { - +
@@ -136,7 +136,7 @@ class Index extends React.Component { You focus on your PHP code. -GraphQL-Controllers comes with an advanced *type-mapper* that automatically translate your PHP types into GraphQL types.`, +GraphQLite comes with an advanced *type-mapper* that automatically translate your PHP types into GraphQL types.`, }, { content: '```php\n' + diff --git a/website/siteConfig.js b/website/siteConfig.js index 89a16a391b..c7d571015d 100755 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -21,16 +21,16 @@ ];*/ const siteConfig = { - title: 'GraphQL-Controllers', // Title for your website. + title: 'GraphQLite', // Title for your website. tagline: 'GraphQL in PHP made easy', url: 'https://thecodingmachine.github.io/', // Your website URL - baseUrl: '/graphql-controllers/', // Base URL for your project */ + baseUrl: '/graphqlite/', // Base URL for your project */ // For github.io type URLs, you would set the url and baseUrl like: // url: 'https://facebook.github.io', // baseUrl: '/test-site/', // Used for publishing and more - projectName: 'graphql-controllers', + projectName: 'graphqlite', organizationName: 'thecodingmachine', // For top-level user or org sites, the organization is still the same. // e.g., for the https://JoelMarcey.github.io site, it would be set like... @@ -39,7 +39,7 @@ const siteConfig = { // For no header links in the top nav bar -> headerLinks: [], headerLinks: [ {doc: 'getting-started', label: 'Docs'}, - {href: 'https://github.com/thecodingmachine/graphql-controllers', label: 'GitHub'}, + {href: 'https://github.com/thecodingmachine/graphqlite', label: 'GitHub'}, /*{doc: 'doc4', label: 'API'},*/ {page: 'help', label: 'Help'}, /*{blog: true, label: 'Blog'},*/ @@ -49,8 +49,8 @@ const siteConfig = { //users, /* path to images for header/footer */ - headerIcon: 'img/graphql-controllers.svg', - footerIcon: 'img/graphql-controllers.svg', + headerIcon: 'img/graphqlite.svg', + footerIcon: 'img/graphqlite.svg', favicon: 'img/logo.svg', /* Colors for website */ diff --git a/website/static/img/graphql-controllers.svg b/website/static/img/graphqlite.svg similarity index 100% rename from website/static/img/graphql-controllers.svg rename to website/static/img/graphqlite.svg