Skip to content

Commit a232c8c

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 fcea4d5 commit a232c8c

File tree

12 files changed

+11
-232
lines changed

12 files changed

+11
-232
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ on:
1818

1919
jobs:
2020
integration:
21-
strategy:
22-
fail-fast: false
23-
matrix:
24-
integration: [laravel, lumen]
25-
name: ${{ matrix.integration }}
21+
name: laravel
2622
runs-on: ubuntu-20.04
2723
env:
2824
COMPOSER_NO_INTERACTION: 1
@@ -53,4 +49,4 @@ jobs:
5349

5450
- run: composer install --prefer-dist --no-suggest
5551

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

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
--------------
66

77
## Breaking changes
8+
- Support for Lumen has been removed
89
- Integrate laragraph/utils RequestParser [\#739 / mfn](https://github.com/rebing/graphql-laravel/pull/739)
910
- batched queries will only work with `POST` requests
1011
This is due to `RequestParser` using `\GraphQL\Server\Helper::parseRequestParams` which includes this check

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
@@ -455,26 +455,11 @@ parameters:
455455
count: 1
456456
path: src/Support/UploadType.php
457457

458-
-
459-
message: "#^Call to method get\\(\\) on an unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
460-
count: 3
461-
path: src/routes.php
462-
463-
-
464-
message: "#^Call to method post\\(\\) on an unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
465-
count: 3
466-
path: src/routes.php
467-
468458
-
469459
message: "#^PHPDoc tag @var for variable \\$queryTypesMap has no value type specified in iterable type array\\.$#"
470460
count: 1
471461
path: src/routes.php
472462

473-
-
474-
message: "#^PHPDoc tag @var for variable \\$router contains unknown class Laravel\\\\Lumen\\\\Routing\\\\Router\\.$#"
475-
count: 2
476-
path: src/routes.php
477-
478463
-
479464
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(array, string\\)\\: bool\\|null given\\.$#"
480465
count: 1

src/GraphQL.php

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

468468
if (count($multiLevelPath) > 1) {
469-
if (Helpers::isLumen()) {
470-
array_walk($multiLevelPath, function (string &$multiName): void {
471-
$multiName = "$multiName:$multiName";
472-
});
473-
}
474-
475469
foreach ($multiLevelPath as $multiName) {
476470
$routeName = !$routeName ? null : $routeName . '/';
477471
$routeName =
@@ -480,7 +474,7 @@ public static function routeNameTransformer(string $name, string $schemaParamete
480474
}
481475
}
482476

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

486480
/**

src/GraphQLController.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function query(Request $request, string $schemaName = null): JsonResponse
3636

3737
// If there are multiple route params we can expect that there
3838
// will be a schema name that has to be built
39-
$routeParameters = $this->getRouteParameters($request);
39+
$routeParameters = $request->route()->parameters;
4040

4141
if (count($routeParameters) > 1) {
4242
$schemaName = implode('/', $routeParameters);
@@ -194,21 +194,6 @@ public function graphiql(Request $request, string $schemaName = null): View
194194
]);
195195
}
196196

197-
/**
198-
* @return array<string,string>
199-
*/
200-
protected function getRouteParameters(Request $request): array
201-
{
202-
if (Helpers::isLumen()) {
203-
/** @var array<int,mixed> $route */
204-
$route = $request->route();
205-
206-
return $route[2] ?? [];
207-
}
208-
209-
return $request->route()->parameters;
210-
}
211-
212197
/**
213198
* In case batching is not supported, send an error back for each batch
214199
* (with a hardcoded limit of 100).

src/GraphQLLumenServiceProvider.php

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

src/Helpers.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77

88
class Helpers
99
{
10-
public static function isLumen(): bool
11-
{
12-
return class_exists('Laravel\Lumen\Application');
13-
}
14-
1510
/**
1611
* Originally from \Nuwave\Lighthouse\Support\Utils::applyEach
1712
*

0 commit comments

Comments
 (0)