Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
36 changes: 18 additions & 18 deletions docs/authentication_authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<div class="alert alert-info"><strong>Heads up!</strong> 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
<div class="alert alert-info"><strong>Heads up!</strong> 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)
</div>

## 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
{
Expand Down Expand Up @@ -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()
Expand All @@ -113,20 +113,20 @@ class Product
```

<a name="connectframework"></a>
## 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`.

<div class="alert alert-info"><strong>Symfony users:</strong> The GraphQL-Controllers bundle comes with the classes linking
GraphQL-Controllers to the security bundle. So you don't have to do anything.
<div class="alert alert-info"><strong>Symfony users:</strong> The GraphQLite bundle comes with the classes linking
GraphQLite to the security bundle. So you don't have to do anything.
</div>

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
Expand Down
10 changes: 5 additions & 5 deletions docs/custom_output_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -26,18 +26,18 @@ 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 {
id: String!
}
```

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
/**
Expand All @@ -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:

Expand Down
8 changes: 4 additions & 4 deletions docs/extend_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand All @@ -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)

<div class="alert alert-warning"><strong>Heads up!</strong> The <code>ProductType</code> class must exist in the container of your
Expand Down
28 changes: 14 additions & 14 deletions docs/external_type_declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand All @@ -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)

<div class="alert alert-warning"><strong>Heads up!</strong> The <code>ProductType</code> class must exist in the container of your
Expand Down Expand Up @@ -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;

/**
Expand All @@ -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;

/**
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/file_uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions docs/inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down Expand Up @@ -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.
Expand All @@ -76,7 +76,7 @@ type User implements ContactInterface {
}
```

<div class="alert alert-warning">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
<div class="alert alert-warning">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.
</div>
4 changes: 2 additions & 2 deletions docs/input_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions docs/mutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
{
Expand Down
Loading