From 2af602e026c9202078b40e9b4b7d5a4c07358c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 5 Mar 2020 22:08:55 +0100 Subject: [PATCH 1/3] Upgrading Diactoros to Laminas and from v1 to v2 --- composer.json | 44 +++++++++++---------- src/Providers/GraphQLiteServiceProvider.php | 24 ++++++++++- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index 8c08611..6afaad3 100644 --- a/composer.json +++ b/composer.json @@ -1,44 +1,46 @@ { - "name" : "thecodingmachine/graphqlite-laravel", - "description" : "A Laravel service provider package to help you get started with GraphQLite in Laravel.", - "keywords" : [ + "name": "thecodingmachine/graphqlite-laravel", + "description": "A Laravel service provider package to help you get started with GraphQLite in Laravel.", + "keywords": [ "GraphQL", "GraphQLite", "Laravel" ], - "homepage" : "https://github.com/thecodingmachine/graphqlite", - "type" : "library", - "license" : "MIT", - "authors" : [{ - "name" : "David Négrier", - "email" : "d.negrier@thecodingmachine.com", - "homepage" : "http://mouf-php.com" + "homepage": "https://github.com/thecodingmachine/graphqlite", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "David N\u00e9grier", + "email": "d.negrier@thecodingmachine.com", + "homepage": "http://mouf-php.com" } ], - "require" : { - "php" : ">=7.2", - "thecodingmachine/graphqlite" : "^4", + "require": { + "php": ">=7.2", + "thecodingmachine/graphqlite": "^4", "illuminate/console": "^5.7|^6.0", "illuminate/container": "^5.7|^6.0", "illuminate/support": "^5.7|^6.0", "illuminate/cache": "^5.7|^6.0", "symfony/psr-http-message-bridge": "^1", - "zendframework/zend-diactoros": "^1.8.6", - "symfony/cache": "^4.3 || ^5" + "laminas/laminas-diactoros": "^2.2.2", + "symfony/cache": "^4.3 || ^5", + "laminas/laminas-dependency-plugin": "^1.0" }, "require-dev": { "orchestra/testbench": "^3.7.7 || ^4", "phpunit/phpunit": "^7.5.4 || ^8.3", "ext-sqlite3": "*" }, - "autoload" : { - "psr-4" : { - "TheCodingMachine\\GraphQLite\\Laravel\\" : "src/" + "autoload": { + "psr-4": { + "TheCodingMachine\\GraphQLite\\Laravel\\": "src/" } }, - "autoload-dev" : { - "psr-4" : { - "App\\" : "tests/Fixtures/App" + "autoload-dev": { + "psr-4": { + "App\\": "tests/Fixtures/App" } }, "extra": { diff --git a/src/Providers/GraphQLiteServiceProvider.php b/src/Providers/GraphQLiteServiceProvider.php index c0f5718..ed15028 100644 --- a/src/Providers/GraphQLiteServiceProvider.php +++ b/src/Providers/GraphQLiteServiceProvider.php @@ -5,6 +5,15 @@ use Illuminate\Contracts\Auth\Access\Gate; use Illuminate\Contracts\Auth\Factory as AuthFactory; use Illuminate\Contracts\Events\Dispatcher; +use Laminas\Diactoros\ResponseFactory; +use Laminas\Diactoros\ServerRequestFactory; +use Laminas\Diactoros\StreamFactory; +use Laminas\Diactoros\UploadedFileFactory; +use Psr\Http\Message\ResponseFactoryInterface; +use Psr\Http\Message\ServerRequestFactoryInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\UploadedFileFactoryInterface; +use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Symfony\Component\Cache\Adapter\ApcuAdapter; use Symfony\Component\Cache\Adapter\PhpFilesAdapter; use Symfony\Component\Cache\Psr16Cache; @@ -62,7 +71,20 @@ public function register() { $this->app->bind(WebonyxSchema::class, Schema::class); - $this->app->bind(HttpMessageFactoryInterface::class, DiactorosFactory::class); + if (!$this->app->has(ServerRequestFactoryInterface::class)) { + $this->app->bind(ServerRequestFactoryInterface::class, ServerRequestFactory::class); + } + if (!$this->app->has(StreamFactoryInterface::class)) { + $this->app->bind(StreamFactoryInterface::class, StreamFactory::class); + } + if (!$this->app->has(UploadedFileFactoryInterface::class)) { + $this->app->bind(UploadedFileFactoryInterface::class, UploadedFileFactory::class); + } + if (!$this->app->has(ResponseFactoryInterface::class)) { + $this->app->bind(ResponseFactoryInterface::class, ResponseFactory::class); + } + + $this->app->bind(HttpMessageFactoryInterface::class, PsrHttpFactory::class); $this->app->singleton(GraphQLiteController::class, function (Application $app) { $debug = config('graphqlite.debug', Debug::RETHROW_UNSAFE_EXCEPTIONS); From 9f5920a0d421710affa3f6498b2f4da68e1e2782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 5 Mar 2020 22:09:44 +0100 Subject: [PATCH 2/3] Removing laminas dependency plugin --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6afaad3..01b4e71 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,7 @@ "illuminate/cache": "^5.7|^6.0", "symfony/psr-http-message-bridge": "^1", "laminas/laminas-diactoros": "^2.2.2", - "symfony/cache": "^4.3 || ^5", - "laminas/laminas-dependency-plugin": "^1.0" + "symfony/cache": "^4.3 || ^5" }, "require-dev": { "orchestra/testbench": "^3.7.7 || ^4", From be067b301b230a7f99b2e719a1549ad87acee2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 5 Mar 2020 22:13:44 +0100 Subject: [PATCH 3/3] Upgrading Symfony HTTP message bridge to ^2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 01b4e71..80c9f04 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "illuminate/container": "^5.7|^6.0", "illuminate/support": "^5.7|^6.0", "illuminate/cache": "^5.7|^6.0", - "symfony/psr-http-message-bridge": "^1", + "symfony/psr-http-message-bridge": "^1.3.0 || ^2", "laminas/laminas-diactoros": "^2.2.2", "symfony/cache": "^4.3 || ^5" },