From 88fae64c8633d8aa4c392c9db6ace1f5c17a366d Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Mon, 29 Jun 2026 15:35:19 -0400 Subject: [PATCH] fix: add guzzel dependency Signed-off-by: Sebastian Krupinski --- composer.json | 2 + composer.lock | 285 ++++++++++++++++++++++----- lib/Service/Remote/RemoteService.php | 24 ++- 3 files changed, 251 insertions(+), 60 deletions(-) diff --git a/composer.json b/composer.json index 6928359..a9b5ad6 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,8 @@ } ], "require": { + "guzzlehttp/guzzle": "^7.0", + "guzzlehttp/psr7": "^2.0", "php": ">=8.2 <=8.5", "sebastiankrupinski/jmap-client-php": "dev-main" }, diff --git a/composer.lock b/composer.lock index 87a3135..e2441ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,30 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "922dd87cbee28a0587b20aee3c8645bf", + "content-hash": "301e594c1dc2f6abe2a152da4e6076aa", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "7.10.0", + "version": "7.13.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" + "reference": "a4decaa9745dc567467970e43f183e260cfa51fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", - "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a4decaa9745dc567467970e43f183e260cfa51fd", + "reference": "a4decaa9745dc567467970e43f183e260cfa51fd", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.3", - "guzzlehttp/psr7": "^2.8", + "guzzlehttp/promises": "^2.5", + "guzzlehttp/psr7": "^2.12.3", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2 || ^3.0" + "symfony/deprecation-contracts": "^2.5 || ^3.0", + "symfony/polyfill-php80": "^1.25" }, "provide": { "psr/http-client-implementation": "1.0" @@ -35,8 +36,9 @@ "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", "guzzle/client-integration-tests": "3.0.2", + "guzzlehttp/test-server": "^0.6", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "phpunit/phpunit": "^8.5.52 || ^9.6.34", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -114,7 +116,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.10.0" + "source": "https://github.com/guzzle/guzzle/tree/7.13.0" }, "funding": [ { @@ -130,28 +132,29 @@ "type": "tidelift" } ], - "time": "2025-08-23T22:36:01+00:00" + "time": "2026-06-29T13:31:06+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.3.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "481557b130ef3790cf82b713667b43030dc9c957" + "reference": "4360e982f87f5f258bf872d094647791db2f4c8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", - "reference": "481557b130ef3790cf82b713667b43030dc9c957", + "url": "https://api.github.com/repos/guzzle/promises/zipball/4360e982f87f5f258bf872d094647791db2f4c8e", + "reference": "4360e982f87f5f258bf872d094647791db2f4c8e", "shasum": "" }, "require": { - "php": "^7.2.5 || ^8.0" + "php": "^7.2.5 || ^8.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "phpunit/phpunit": "^8.5.52 || ^9.6.34" }, "type": "library", "extra": { @@ -197,7 +200,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.3.0" + "source": "https://github.com/guzzle/promises/tree/2.5.0" }, "funding": [ { @@ -213,27 +216,29 @@ "type": "tidelift" } ], - "time": "2025-08-22T14:34:08+00:00" + "time": "2026-06-02T12:23:43+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.8.0", + "version": "2.12.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "21dc724a0583619cd1652f673303492272778051" + "reference": "7ec62dc3f44aa218487dbed81a9bf9bc647be55d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051", - "reference": "21dc724a0583619cd1652f673303492272778051", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/7ec62dc3f44aa218487dbed81a9bf9bc647be55d", + "reference": "7ec62dc3f44aa218487dbed81a9bf9bc647be55d", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.1 || ^2.0", - "ralouphie/getallheaders": "^3.0" + "ralouphie/getallheaders": "^3.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", + "symfony/polyfill-php80": "^1.25" }, "provide": { "psr/http-factory-implementation": "1.0", @@ -241,8 +246,9 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "http-interop/http-factory-tests": "0.9.0", - "phpunit/phpunit": "^8.5.44 || ^9.6.25" + "http-interop/http-factory-tests": "1.1.0", + "jshttp/mime-db": "1.54.0.1", + "phpunit/phpunit": "^8.5.52 || ^9.6.34" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -313,7 +319,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.8.0" + "source": "https://github.com/guzzle/psr7/tree/2.12.3" }, "funding": [ { @@ -329,7 +335,86 @@ "type": "tidelift" } ], - "time": "2025-08-23T21:21:41+00:00" + "time": "2026-06-23T15:21:08+00:00" + }, + { + "name": "php-http/discovery", + "version": "1.20.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/discovery.git", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + }, + "type": "composer-plugin", + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "homepage": "http://php-http.org", + "keywords": [ + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr17", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.20.0" + }, + "time": "2024-10-02T11:20:13+00:00" }, { "name": "psr/http-client", @@ -541,21 +626,26 @@ "source": { "type": "git", "url": "https://github.com/SebastianKrupinski/jmap-client-php.git", - "reference": "bd754c3364a44273682e94a0118a0770aa3b7449" + "reference": "720ba6ee0579202e5fedab39847680cc5c7ebf58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SebastianKrupinski/jmap-client-php/zipball/bd754c3364a44273682e94a0118a0770aa3b7449", - "reference": "bd754c3364a44273682e94a0118a0770aa3b7449", + "url": "https://api.github.com/repos/SebastianKrupinski/jmap-client-php/zipball/720ba6ee0579202e5fedab39847680cc5c7ebf58", + "reference": "720ba6ee0579202e5fedab39847680cc5c7ebf58", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/guzzle": "^7.0", - "php": "^8.0" + "php": "^8.0", + "php-http/discovery": "^1.19", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.89" + "friendsofphp/php-cs-fixer": "^3.89", + "guzzlehttp/guzzle": "^7.0", + "phpunit/phpunit": "^11.0" }, "default-branch": true, "type": "library", @@ -572,10 +662,10 @@ }, "scripts": { "test:unit": [ - "phpunit --testsuite 'Unit Tests'" + "./vendor/bin/phpunit --testsuite 'Unit Tests'" ], "test:integration": [ - "phpunit --testsuite 'Integration Tests'" + "./vendor/bin/phpunit --testsuite 'Integration Tests'" ], "cs:check": [ "php-cs-fixer fix --dry-run --diff" @@ -585,7 +675,7 @@ ] }, "license": [ - "AGL3" + "AGPL-3.0-only" ], "authors": [ { @@ -595,29 +685,36 @@ "role": "Just another Minion in the cogs of time" } ], - "description": "JMAP PHP Client", + "description": "Type-safe PHP client for JMAP mail, calendar, contacts, files, and tasks APIs", "homepage": "https://github.com/SebastianKrupinski/jmap-client-php", "keywords": [ - "enum" + "api-client", + "calendar", + "contacts", + "email", + "files", + "jmap", + "mail", + "tasks" ], "support": { - "source": "https://github.com/SebastianKrupinski/jmap-client-php/tree/main", - "issues": "https://github.com/SebastianKrupinski/jmap-client-php/issues" + "issues": "https://github.com/SebastianKrupinski/jmap-client-php/issues", + "source": "https://github.com/SebastianKrupinski/jmap-client-php" }, - "time": "2025-11-07T22:31:45+00:00" + "time": "2026-06-27T23:55:59+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.6.0", + "version": "v3.7.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", + "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", "shasum": "" }, "require": { @@ -630,7 +727,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.7-dev" } }, "autoload": { @@ -655,7 +752,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" }, "funding": [ { @@ -666,12 +763,100 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2024-09-25T14:21:43+00:00" + "time": "2026-06-05T06:23:12+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411", + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T16:19:22+00:00" } ], "packages-dev": [ @@ -2471,5 +2656,5 @@ "platform-overrides": { "php": "8.2" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/lib/Service/Remote/RemoteService.php b/lib/Service/Remote/RemoteService.php index f762e8a..4a5f2e7 100644 --- a/lib/Service/Remote/RemoteService.php +++ b/lib/Service/Remote/RemoteService.php @@ -9,16 +9,12 @@ declare(strict_types=1); namespace KTXM\ProviderJmapc\Service\Remote; +use GuzzleHttp\Client as HttpClient; +use GuzzleHttp\Psr7\HttpFactory; use JmapClient\Authentication\Basic; -use JmapClient\Authentication\Bearer; -use JmapClient\Authentication\JsonBasic; -use JmapClient\Authentication\JsonBasicCookie; use JmapClient\Client as JmapClient; use KTXC\Server; -use KTXF\Resource\Provider\ResourceServiceBaseInterface; use KTXF\Resource\Provider\ResourceServiceIdentityBasic; -use KTXF\Resource\Provider\ResourceServiceIdentityBearer; -use KTXF\Resource\Provider\ResourceServiceIdentityOAuth; use KTXF\Resource\Provider\ResourceServiceLocationUri; use KTXM\ProviderJmapc\Providers\Mail\Service as MailService; use KTXM\ProviderJmapc\Providers\Contacts\Service as ContactsService; @@ -40,9 +36,6 @@ class RemoteService { */ public static function freshClient(MailService|FilesService $service): JmapClient { - // defaults - $client = new JmapClient(); - $client->setTransportAgent(self::$clientTransportAgent); $location = $service->getLocation(); $identity = $service->getIdentity(); @@ -50,12 +43,23 @@ class RemoteService { if ($location instanceof ResourceServiceLocationUri === false) { throw new \InvalidArgumentException('Service location is not a valid URI'); } + + // The JMAP client accepts transport abstractions only. Guzzle supplies the + // PSR-18 client, while HttpFactory supplies both required PSR-17 factories. + $httpFactory = new HttpFactory(); + $client = new JmapClient( + transportClient: new HttpClient([ + 'verify' => $location->getVerifyPeer(), + ]), + requestFactory: $httpFactory, + streamFactory: $httpFactory, + ); + $client->setTransportAgent(self::$clientTransportAgent); $client->configureTransportMode($location->getScheme()); $client->setHost($location->getHost() . ':' . $location->getPort()); if (!empty($location->getPath())) { $client->setDiscoveryPath($location->getPath()); } - $client->configureTransportVerification((bool)$location->getVerifyPeer()); // authentication if (($identity instanceof ResourceServiceIdentityBasic) === false) { throw new \InvalidArgumentException('Service identity is not a valid Basic or Bearer authentication');