Skip to content

Commit 7e2d0dd

Browse files
authored
Merge pull request #23 from moufmouf/upgrade_diactoros
Upgrade Zend Diactoros v1 to Laminas Diactoros v2
2 parents fa4942a + be067b3 commit 7e2d0dd

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

composer.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
{
2-
"name" : "thecodingmachine/graphqlite-laravel",
3-
"description" : "A Laravel service provider package to help you get started with GraphQLite in Laravel.",
4-
"keywords" : [
2+
"name": "thecodingmachine/graphqlite-laravel",
3+
"description": "A Laravel service provider package to help you get started with GraphQLite in Laravel.",
4+
"keywords": [
55
"GraphQL",
66
"GraphQLite",
77
"Laravel"
88
],
9-
"homepage" : "https://github.com/thecodingmachine/graphqlite",
10-
"type" : "library",
11-
"license" : "MIT",
12-
"authors" : [{
13-
"name" : "David Négrier",
14-
"email" : "[email protected]",
15-
"homepage" : "http://mouf-php.com"
9+
"homepage": "https://github.com/thecodingmachine/graphqlite",
10+
"type": "library",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "David N\u00e9grier",
15+
"email": "[email protected]",
16+
"homepage": "http://mouf-php.com"
1617
}
1718
],
18-
"require" : {
19-
"php" : ">=7.2",
20-
"thecodingmachine/graphqlite" : "^4",
19+
"require": {
20+
"php": ">=7.2",
21+
"thecodingmachine/graphqlite": "^4",
2122
"illuminate/console": "^5.7|^6.0",
2223
"illuminate/container": "^5.7|^6.0",
2324
"illuminate/support": "^5.7|^6.0",
2425
"illuminate/cache": "^5.7|^6.0",
25-
"symfony/psr-http-message-bridge": "^1",
26-
"zendframework/zend-diactoros": "^1.8.6",
26+
"symfony/psr-http-message-bridge": "^1.3.0 || ^2",
27+
"laminas/laminas-diactoros": "^2.2.2",
2728
"symfony/cache": "^4.3 || ^5"
2829
},
2930
"require-dev": {
3031
"orchestra/testbench": "^3.7.7 || ^4",
3132
"phpunit/phpunit": "^7.5.4 || ^8.3",
3233
"ext-sqlite3": "*"
3334
},
34-
"autoload" : {
35-
"psr-4" : {
36-
"TheCodingMachine\\GraphQLite\\Laravel\\" : "src/"
35+
"autoload": {
36+
"psr-4": {
37+
"TheCodingMachine\\GraphQLite\\Laravel\\": "src/"
3738
}
3839
},
39-
"autoload-dev" : {
40-
"psr-4" : {
41-
"App\\" : "tests/Fixtures/App"
40+
"autoload-dev": {
41+
"psr-4": {
42+
"App\\": "tests/Fixtures/App"
4243
}
4344
},
4445
"extra": {

src/Providers/GraphQLiteServiceProvider.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
use Illuminate\Contracts\Auth\Access\Gate;
66
use Illuminate\Contracts\Auth\Factory as AuthFactory;
77
use Illuminate\Contracts\Events\Dispatcher;
8+
use Laminas\Diactoros\ResponseFactory;
9+
use Laminas\Diactoros\ServerRequestFactory;
10+
use Laminas\Diactoros\StreamFactory;
11+
use Laminas\Diactoros\UploadedFileFactory;
12+
use Psr\Http\Message\ResponseFactoryInterface;
13+
use Psr\Http\Message\ServerRequestFactoryInterface;
14+
use Psr\Http\Message\StreamFactoryInterface;
15+
use Psr\Http\Message\UploadedFileFactoryInterface;
16+
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
817
use Symfony\Component\Cache\Adapter\ApcuAdapter;
918
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
1019
use Symfony\Component\Cache\Psr16Cache;
@@ -62,7 +71,20 @@ public function register()
6271
{
6372
$this->app->bind(WebonyxSchema::class, Schema::class);
6473

65-
$this->app->bind(HttpMessageFactoryInterface::class, DiactorosFactory::class);
74+
if (!$this->app->has(ServerRequestFactoryInterface::class)) {
75+
$this->app->bind(ServerRequestFactoryInterface::class, ServerRequestFactory::class);
76+
}
77+
if (!$this->app->has(StreamFactoryInterface::class)) {
78+
$this->app->bind(StreamFactoryInterface::class, StreamFactory::class);
79+
}
80+
if (!$this->app->has(UploadedFileFactoryInterface::class)) {
81+
$this->app->bind(UploadedFileFactoryInterface::class, UploadedFileFactory::class);
82+
}
83+
if (!$this->app->has(ResponseFactoryInterface::class)) {
84+
$this->app->bind(ResponseFactoryInterface::class, ResponseFactory::class);
85+
}
86+
87+
$this->app->bind(HttpMessageFactoryInterface::class, PsrHttpFactory::class);
6688

6789
$this->app->singleton(GraphQLiteController::class, function (Application $app) {
6890
$debug = config('graphqlite.debug', Debug::RETHROW_UNSAFE_EXCEPTIONS);

0 commit comments

Comments
 (0)