Skip to content

Commit 4366d83

Browse files
committed
Remove support for Lumen
Supporting Lumen without a dedicated framework for testing is a nightmare, so many unresolved issues and very few contributions over the years led me to believe we're better off removing support. The readme never went beyond calling it "experimental". This PR targets the next major release due to this breaking change.
1 parent 13b9389 commit 4366d83

File tree

12 files changed

+13
-238
lines changed

12 files changed

+13
-238
lines changed

.github/ISSUE_TEMPLATE/1_Bug_report.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ labels: bug
88
### Versions:
99
- graphql-laravel Version: #.#.#
1010
- Laravel Version: #.#.# <!-- remove if not applicable -->
11-
- Lumen Version: #.#.# <!-- remove if not applicable -->
1211
- PHP Version: #.#.#
1312

1413
### Description:

.github/ISSUE_TEMPLATE/3_Support_question.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Alternative you can also use our Slack workspace: https://join.slack.com/t/rebin
1111
### Versions:
1212
- graphql-laravel Version: #.#.#
1313
- Laravel Version: #.#.# <!-- remove if not applicable -->
14-
- Lumen Version: #.#.# <!-- remove if not applicable -->
1514
- PHP Version: #.#.#
1615

1716
### Question:

.github/workflows/integration_tests.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ on:
1818

1919
jobs:
2020
integration:
21-
strategy:
22-
matrix:
23-
integration: [laravel, lumen]
24-
name: ${{ matrix.integration }}
21+
name: laravel
2522
runs-on: ubuntu-20.04
2623
env:
2724
COMPOSER_NO_INTERACTION: 1
@@ -52,4 +49,4 @@ jobs:
5249

5350
- run: composer install --prefer-dist --no-suggest
5451

55-
- run: tests/integration-${{ matrix.integration }}.sh
52+
- run: tests/integration-laravel.sh

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ CHANGELOG
44
[Next release](https://github.com/rebing/graphql-laravel/compare/7.0.0...master)
55
--------------
66

7+
### BREAKING CHANGE
8+
- Support for Lumen has been removed
9+
710
2021-04-03, 7.0.0
811
-----------------
912
## Breaking changes

README.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It offers following features and improvements over the original package by
3232

3333
### Dependencies:
3434

35-
* [Laravel 6.0+](https://github.com/laravel/laravel) or [Lumen](https://github.com/laravel/lumen)
35+
* [Laravel 6.0+](https://github.com/laravel/laravel)
3636
* [GraphQL PHP](https://github.com/webonyx/graphql-php)
3737

3838

@@ -55,37 +55,7 @@ Review the configuration file:
5555
config/graphql.php
5656
```
5757

58-
#### Lumen (experimental!)
59-
60-
**1.** Add the following service provider to the `bootstrap/app.php` file
61-
```php
62-
$app->register(Rebing\GraphQL\GraphQLLumenServiceProvider::class);
63-
```
64-
65-
**2.** Publish the configuration file
66-
```bash
67-
$ php artisan graphql:publish
68-
```
69-
70-
**3.** Add the configuration to the `bootstrap/app.php` file
71-
*Important:* this needs to be before the registration of the service provider
72-
```php
73-
$app->configure('graphql');
74-
...
75-
$app->register(Rebing\GraphQL\GraphQLLumenServiceProvider::class);
76-
```
77-
78-
**4.** Review the configuration file
79-
```php
80-
config/graphql.php
81-
```
82-
8358
The default GraphiQL view makes use of the global `csrf_token()` helper function.
84-
Out of the box, this function is not available in Lumen.
85-
86-
To work this around:
87-
- Point to your local GraphiQL view: change `graphql.view` to `'vendor/graphql/graphiql'`
88-
- Modify your file `resources/views/vendor/graphql/graphiql.php` and remove the call
8959

9060
## Usage
9161

@@ -94,7 +64,6 @@ To work this around:
9464
- [Dependencies:](#dependencies)
9565
- [Installation:](#installation)
9666
- [Laravel 6.0+](#laravel)
97-
- [Lumen (experimental!)](#lumen-experimental)
9867
- [Usage](#usage)
9968
- [Concepts](#concepts)
10069
- [Data loading](#data-loading)

phpstan-baseline.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,6 @@ parameters:
480480
count: 1
481481
path: src/Support/UploadType.php
482482

483-
-
484-
message: "#^PHPDoc tag @var for variable \\$router contains unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
485-
count: 2
486-
path: src/routes.php
487-
488483
-
489484
message: "#^PHPDoc tag @var for variable \\$queryTypesMap has no value type specified in iterable type array\\.$#"
490485
count: 1
@@ -495,16 +490,6 @@ parameters:
495490
count: 1
496491
path: src/routes.php
497492

498-
-
499-
message: "#^Call to method get\\(\\) on an unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
500-
count: 3
501-
path: src/routes.php
502-
503-
-
504-
message: "#^Call to method post\\(\\) on an unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
505-
count: 3
506-
path: src/routes.php
507-
508493
-
509494
message: "#^Property Rebing\\\\GraphQL\\\\Tests\\\\Database\\\\AuthorizeArgsTests\\\\GraphQLContext\\:\\:\\$data has no typehint specified\\.$#"
510495
count: 1

src/GraphQL.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,6 @@ public static function routeNameTransformer(string $name, string $schemaParamete
472472
$routeName = null;
473473

474474
if (count($multiLevelPath) > 1) {
475-
if (Helpers::isLumen()) {
476-
array_walk($multiLevelPath, function (string &$multiName): void {
477-
$multiName = "$multiName:$multiName";
478-
});
479-
}
480-
481475
foreach ($multiLevelPath as $multiName) {
482476
$routeName = ! $routeName ? null : $routeName.'/';
483477
$routeName =
@@ -486,7 +480,7 @@ public static function routeNameTransformer(string $name, string $schemaParamete
486480
}
487481
}
488482

489-
return $routeName ?: preg_replace($schemaParameterPattern, '{'.(Helpers::isLumen() ? "schema:$name" : $name).'}', $queryRoute);
483+
return $routeName ?: preg_replace($schemaParameterPattern, '{'.$name.'}', $queryRoute);
490484
}
491485

492486
/**

src/GraphQLController.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function query(Request $request, string $schema = null): JsonResponse
2828

2929
// If there are multiple route params we can expect that there
3030
// will be a schema name that has to be built
31-
$routeParameters = $this->getRouteParameters($request);
31+
$routeParameters = $request->route()->parameters;
3232
if (count($routeParameters) > 1) {
3333
$schema = implode('/', $routeParameters);
3434
}
@@ -101,20 +101,4 @@ public function graphiql(Request $request, string $schema = null): View
101101
'schema' => $schema,
102102
]);
103103
}
104-
105-
/**
106-
* @param Request $request
107-
* @return array<string,string>
108-
*/
109-
protected function getRouteParameters(Request $request): array
110-
{
111-
if (Helpers::isLumen()) {
112-
/** @var array<int,mixed> $route */
113-
$route = $request->route();
114-
115-
return $route[2] ?? [];
116-
}
117-
118-
return $request->route()->parameters;
119-
}
120104
}

src/GraphQLLumenServiceProvider.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Helpers.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)