diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index b0477a7..ebd21b9 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -34,6 +34,9 @@ jobs:
- name: Validate Composer manifest and lock
run: composer validate --no-check-publish --no-interaction
+ - name: Audit locked dependencies
+ run: composer audit --locked --no-interaction
+
- name: Install locked dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
diff --git a/README.md b/README.md
index 035871e..07a3fda 100644
--- a/README.md
+++ b/README.md
@@ -19,3 +19,85 @@
+
+## Совместимость
+
+- PHP 8.2 или новее.
+- Triangle Engine `^9.0` и Localzet HTTP Client `^3.0`; эта ветка рассчитана на Localzet Server 7.
+
+## Установка
+
+```sh
+composer require triangle/oauth
+```
+
+Добавьте провайдера в конфигурацию Triangle Engine:
+
+```php
+$oauth = new \Triangle\OAuth([
+ 'providers' => [
+ 'google' => [
+ 'enabled' => true,
+ 'callback' => 'https://app.example.com/oauth/google/callback',
+ 'keys' => [
+ 'id' => getenv('GOOGLE_CLIENT_ID'),
+ 'secret' => getenv('GOOGLE_CLIENT_SECRET'),
+ ],
+ ],
+ ],
+]);
+
+$result = $oauth->authenticate('google');
+if ($result instanceof \Triangle\Engine\Response) {
+ return $result; // Redirect the browser to the provider.
+}
+
+$profile = $result->getUserProfile();
+```
+
+Если передать HTTP-клиент явно через конструктор адаптера или `setHttpClient()`, будет использован именно он; `http_client_options` применяется, когда адаптер создаёт клиент самостоятельно.
+
+`authenticate()` returns an Engine response while starting authorization and the provider adapter after authentication. Keep client secrets in environment configuration. Provider-specific options and examples are in the [Triangle OAuth documentation](https://docs.localzet.com/triangle/oauth).
+
+For HTTP client settings, use the provider option `http_client_options` supported by Localzet HTTP Client 3, for example `['timeout' => 10]` or a TLS `context`. The old `curl_options` setting is unsupported by HTTP Client 3.
+
+An HTTP client passed explicitly to an adapter constructor or `setHttpClient()` is used as-is. `http_client_options` applies when the adapter creates its own client.
+
+## Compatibility
+
+- PHP 8.2 or newer.
+- Triangle Engine `^9.0` and Localzet HTTP Client `^3.0`; this branch targets Localzet Server 7.
+
+## Installation
+
+```sh
+composer require triangle/oauth
+```
+
+Add a provider to your Triangle Engine configuration:
+
+```php
+$oauth = new \Triangle\OAuth([
+ 'providers' => [
+ 'google' => [
+ 'enabled' => true,
+ 'callback' => 'https://app.example.com/oauth/google/callback',
+ 'keys' => [
+ 'id' => getenv('GOOGLE_CLIENT_ID'),
+ 'secret' => getenv('GOOGLE_CLIENT_SECRET'),
+ ],
+ ],
+ ],
+]);
+
+$result = $oauth->authenticate('google');
+if ($result instanceof \Triangle\Engine\Response) {
+ return $result; // Redirect the browser to the provider.
+}
+
+$profile = $result->getUserProfile();
+```
+
+`authenticate()` returns an Engine response to start authorization and the provider adapter after authentication. Keep client secrets in environment configuration. See the [Triangle OAuth documentation](https://docs.localzet.com/triangle/oauth) for provider-specific options and examples.
+
+Use the provider option `http_client_options` for Localzet HTTP Client 3, such as `['timeout' => 10]` or TLS `context` settings. The old `curl_options` option is not supported by HTTP Client 3.
diff --git a/composer.json b/composer.json
index 510edec..9a7fb3d 100644
--- a/composer.json
+++ b/composer.json
@@ -40,8 +40,8 @@
"ext-mbstring": "*",
"ext-json": "*",
"ext-curl": "*",
- "localzet/http": "^2.0",
- "triangle/engine": "^8.1"
+ "localzet/http": "^3.0",
+ "triangle/engine": "^9.0"
},
"suggest": {
"ext-libxml": "Требуется для провайдера Steam",
@@ -54,6 +54,9 @@
"Triangle\\": "src"
}
},
+ "scripts": {
+ "test": "php tests/oauth_authenticate_redirect.php"
+ },
"config": {
"platform": {
"php": "8.2.0"
diff --git a/composer.lock b/composer.lock
index 94d6948..a75ad31 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,83 +4,33 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ddff57a955b4e59fb60de81a9aa56ff1",
+ "content-hash": "aa7320f52abea5ae02ce05839b3030d5",
"packages": [
- {
- "name": "localzet/events",
- "version": "v1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/localzet/Events.git",
- "reference": "1fbd7ea366482844296cbb0f212b42a7c84546e9"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/localzet/Events/zipball/1fbd7ea366482844296cbb0f212b42a7c84546e9",
- "reference": "1fbd7ea366482844296cbb0f212b42a7c84546e9",
- "shasum": ""
- },
- "require": {
- "php": ">=8.0"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "localzet\\": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "AGPL-3.0-or-later"
- ],
- "authors": [
- {
- "name": "Ivan Zorin",
- "email": "creator@localzet.com",
- "homepage": "https://github.com/localzet",
- "role": "Developer"
- }
- ],
- "description": "Simple Events Manage Library",
- "keywords": [
- "events",
- "localzet"
- ],
- "support": {
- "email": "support@localzet.com",
- "issues": "https://github.com/localzet/Events/issues",
- "source": "https://github.com/localzet/Events"
- },
- "funding": [
- {
- "url": "https://github.com/localzet",
- "type": "github"
- }
- ],
- "time": "2024-10-15T19:25:13+00:00"
- },
{
"name": "localzet/http",
- "version": "v2.0.2",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/localzet/HttpClient.git",
- "reference": "4c30a96fac053eb25667014e375c4f438f1db0e6"
+ "reference": "eae04078c17d693ceb54c21d01ccd49d81a5d5d1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/localzet/HttpClient/zipball/4c30a96fac053eb25667014e375c4f438f1db0e6",
- "reference": "4c30a96fac053eb25667014e375c4f438f1db0e6",
+ "url": "https://api.github.com/repos/localzet/HttpClient/zipball/eae04078c17d693ceb54c21d01ccd49d81a5d5d1",
+ "reference": "eae04078c17d693ceb54c21d01ccd49d81a5d5d1",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
- "localzet/psr7": "^3.0",
- "localzet/server": "^4.2",
- "php": "^8.0",
+ "localzet/psr7": "^4.0",
+ "localzet/server": "^7.0",
+ "php": "^8.2",
"psr/http-message": "^2.0"
},
+ "suggest": {
+ "ext-openssl": "Required only when using HTTPS requests."
+ },
"type": "library",
"autoload": {
"psr-4": {
@@ -99,7 +49,7 @@
"role": "Developer"
}
],
- "description": "Localzet HTTP Client is a library for making HTTP requests. It is developed by Ivan Zorin and uses modern technologies and standards for efficient and reliable HTTP communication.",
+ "description": "Asynchronous HTTP requests and connection pooling for Localzet Server.",
"keywords": [
"AGPL",
"client",
@@ -123,31 +73,31 @@
"type": "github"
}
],
- "time": "2024-10-26T12:32:37+00:00"
+ "time": "2026-11-20T02:17:38+00:00"
},
{
"name": "localzet/psr7",
- "version": "v3.0.2",
+ "version": "v4.0.0",
"source": {
"type": "git",
"url": "https://github.com/localzet/PSR-7.git",
- "reference": "fa5653a00639af61803d97550c763da662a5cfd7"
+ "reference": "c2cfda0206a7848e148373860bcf245d3cd66854"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/localzet/PSR-7/zipball/fa5653a00639af61803d97550c763da662a5cfd7",
- "reference": "fa5653a00639af61803d97550c763da662a5cfd7",
+ "url": "https://api.github.com/repos/localzet/PSR-7/zipball/c2cfda0206a7848e148373860bcf245d3cd66854",
+ "reference": "c2cfda0206a7848e148373860bcf245d3cd66854",
"shasum": ""
},
"require": {
- "localzet/server": "^4.1",
+ "localzet/server": "^7.0",
"php": "^8.2",
"psr/http-message": "^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.5-dev"
+ "dev-master": "4.0-dev"
}
},
"autoload": {
@@ -170,7 +120,7 @@
"role": "Developer"
}
],
- "description": "Localzet PSR7 is a library that provides HTTP message interfaces. Developed by Ivan Zorin, it adheres to the PSR-7 standard for HTTP message interfaces in PHP.",
+ "description": "HTTP message objects, streams and URI utilities.",
"keywords": [
"AGPL",
"http",
@@ -187,51 +137,55 @@
"issues": "https://github.com/localzet/PSR-7/issues",
"source": "https://github.com/localzet/PSR-7"
},
- "time": "2024-07-21T19:53:52+00:00"
+ "funding": [
+ {
+ "url": "https://github.com/localzet",
+ "type": "github"
+ }
+ ],
+ "time": "2026-11-02T11:39:02+00:00"
},
{
"name": "localzet/server",
- "version": "v4.5.3",
+ "version": "v7.2.3",
"source": {
"type": "git",
"url": "https://github.com/localzet/Server.git",
- "reference": "07764f3ca0af09f2945a00b53fc8e54b2acc4766"
+ "reference": "b8fb8b00eae391eac7450e20de410505f6cda530"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/localzet/Server/zipball/07764f3ca0af09f2945a00b53fc8e54b2acc4766",
- "reference": "07764f3ca0af09f2945a00b53fc8e54b2acc4766",
+ "url": "https://api.github.com/repos/localzet/Server/zipball/b8fb8b00eae391eac7450e20de410505f6cda530",
+ "reference": "b8fb8b00eae391eac7450e20de410505f6cda530",
"shasum": ""
},
"require": {
+ "ext-ctype": "*",
"ext-json": "*",
- "ext-pcntl": "*",
- "ext-posix": "*",
- "ext-sockets": "*",
- "localzet/events": "^1",
- "php": "^8.1 || ^8.2"
- },
- "conflict": {
- "ext-swow": "=8.1"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "*",
- "phpunit/phpunit": "^9 || ^10",
- "rector/rector": "*",
- "vimeo/psalm": "*"
+ "phpstan/phpstan": "^2.3",
+ "revolt/event-loop": "^1.0"
},
"suggest": {
- "ext-ev": "For better performance with libev.",
- "ext-event": "For better performance with libevent.",
- "ext-redis": "For Redis Session Handler support.",
- "ext-swoole": "For enhanced async capabilities and performance.",
- "ext-swow": "For next-gen async PHP features.",
- "ext-uv": "For better performance with libuv.",
- "mongodb/mongodb": "For MongoDB Session Handler support."
- },
- "type": "project",
+ "ext-ev": "Native libev backend.",
+ "ext-event": "Native libevent backend.",
+ "ext-pcntl": "Multi-process supervision and hot-upgrade on Unix.",
+ "ext-posix": "Unix process, signal and privilege management.",
+ "ext-redis": "Redis-backed HTTP sessions.",
+ "ext-sockets": "Socket tuning and zero-downtime hot-upgrade descriptor passing.",
+ "ext-swoole": "Optional native Swoole coroutine event backend.",
+ "ext-swow": "Optional native Swow coroutine event backend.",
+ "localzet/events": "Optional Localzet lifecycle event bus integration.",
+ "mongodb/mongodb": "MongoDB-backed HTTP sessions.",
+ "revolt/event-loop": "Fiber-based event loop backend and non-blocking Timer::sleep()."
+ },
+ "type": "library",
"extra": {
- "branch-alias": []
+ "branch-alias": {
+ "dev-main": "7.2.x-dev"
+ }
},
"autoload": {
"files": [
@@ -239,7 +193,7 @@
],
"psr-4": {
"localzet\\": "",
- "localzet\\Server\\": "src"
+ "localzet\\Server\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -254,24 +208,18 @@
"role": "Developer"
}
],
- "description": "Localzet Server is a high-performance asynchronous event-driven server for PHP, designed for modern applications with scalability and security in mind.",
+ "description": "High-performance asynchronous event-driven server for PHP.",
"keywords": [
- "AGPL",
- "async",
"asynchronous",
- "event-driven",
- "pcntl",
- "performance",
- "php",
- "posix",
- "psr",
- "scalability",
- "security",
+ "event-loop",
+ "http",
"server",
- "sockets"
+ "tcp",
+ "udp",
+ "websocket"
],
"support": {
- "docs": "https://docs.localzet.com",
+ "docs": "https://server.localzet.com",
"email": "support@localzet.com",
"issues": "https://github.com/localzet/Server/issues",
"source": "https://github.com/localzet/Server"
@@ -282,46 +230,48 @@
"type": "github"
}
],
- "time": "2025-05-06T23:36:38+00:00"
+ "time": "2026-11-22T19:18:30+00:00"
},
{
"name": "monolog/monolog",
- "version": "2.11.1",
+ "version": "3.13.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "bf2403f591c5a431b6e0e1170cbadd3d64499564"
+ "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bf2403f591c5a431b6e0e1170cbadd3d64499564",
- "reference": "bf2403f591c5a431b6e0e1170cbadd3d64499564",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac",
+ "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac",
"shasum": ""
},
"require": {
- "php": ">=7.2",
- "psr/log": "^1.0.1 || ^2.0 || ^3.0"
+ "php": ">=8.1",
+ "psr/log": "^2.0 || ^3.0"
},
"provide": {
- "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
+ "psr/log-implementation": "3.0.0"
},
"require-dev": {
- "aws/aws-sdk-php": "^2.4.9 || ^3.0",
+ "aws/aws-sdk-php": "^3.0",
"doctrine/couchdb": "~1.0@dev",
"elasticsearch/elasticsearch": "^7 || ^8",
"ext-json": "*",
- "graylog2/gelf-php": "^1.4.2 || ^2@dev",
- "guzzlehttp/guzzle": "^7.4",
+ "graylog2/gelf-php": "^1.4.2 || ^2.0",
+ "guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/psr7": "^2.2",
"mongodb/mongodb": "^1.8 || ^2.0",
"php-amqplib/php-amqplib": "~2.4 || ^3",
- "phpspec/prophecy": "^1.15",
- "phpstan/phpstan": "^1.10",
- "phpunit/phpunit": "^8.5.38 || ^9.6.19",
- "predis/predis": "^1.1 || ^2.0",
- "rollbar/rollbar": "^1.3 || ^2 || ^3",
- "ruflin/elastica": "^7",
- "swiftmailer/swiftmailer": "^5.3|^6.0",
+ "php-console/php-console": "^3.1.8",
+ "phpstan/phpstan": "^2",
+ "phpstan/phpstan-deprecation-rules": "^2",
+ "phpstan/phpstan-strict-rules": "^2",
+ "phpunit/phpunit": "^10.5.17 || ^11.0.7",
+ "predis/predis": "^1.1 || ^2",
+ "psr/clock": "^1.0",
+ "rollbar/rollbar": "^4.0",
+ "ruflin/elastica": "^7 || ^8",
"symfony/mailer": "^5.4 || ^6",
"symfony/mime": "^5.4 || ^6"
},
@@ -338,13 +288,14 @@
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+ "psr/clock": "Required to pass a clock to the Logger and control the timestamp of log records",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "2.x-dev"
+ "dev-main": "3.x-dev"
}
},
"autoload": {
@@ -372,7 +323,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
- "source": "https://github.com/Seldaek/monolog/tree/2.11.1"
+ "source": "https://github.com/Seldaek/monolog/tree/3.13.0"
},
"funding": [
{
@@ -384,7 +335,7 @@
"type": "tidelift"
}
],
- "time": "2026-09-02T07:57:24+00:00"
+ "time": "2026-11-16T10:43:05+00:00"
},
{
"name": "psr/cache",
@@ -437,22 +388,27 @@
},
{
"name": "psr/container",
- "version": "1.1.2",
+ "version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
- "reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
- "reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"shasum": ""
},
"require": {
"php": ">=7.4.0"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
@@ -479,9 +435,9 @@
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
- "source": "https://github.com/php-fig/container/tree/1.1.2"
+ "source": "https://github.com/php-fig/container/tree/2.0.2"
},
- "time": "2021-11-05T16:50:12+00:00"
+ "time": "2021-11-05T16:47:00+00:00"
},
{
"name": "psr/http-message",
@@ -588,16 +544,16 @@
},
{
"name": "symfony/cache",
- "version": "v6.4.49",
+ "version": "v6.4.50",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache.git",
- "reference": "4deac40a72d25b95c8558544a3d2346813628ab4"
+ "reference": "c0ed759f3cd916a57a0413331260a727c290af0b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/cache/zipball/4deac40a72d25b95c8558544a3d2346813628ab4",
- "reference": "4deac40a72d25b95c8558544a3d2346813628ab4",
+ "url": "https://api.github.com/repos/symfony/cache/zipball/c0ed759f3cd916a57a0413331260a727c290af0b",
+ "reference": "c0ed759f3cd916a57a0413331260a727c290af0b",
"shasum": ""
},
"require": {
@@ -664,7 +620,7 @@
"psr6"
],
"support": {
- "source": "https://github.com/symfony/cache/tree/v6.4.49"
+ "source": "https://github.com/symfony/cache/tree/v6.4.50"
},
"funding": [
{
@@ -684,20 +640,20 @@
"type": "tidelift"
}
],
- "time": "2026-10-28T08:19:01+00:00"
+ "time": "2026-11-01T19:34:58+00:00"
},
{
"name": "symfony/cache-contracts",
- "version": "v3.7.1",
+ "version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache-contracts.git",
- "reference": "9789738bc19af1106dc54d6afba9a0b467516cf2"
+ "reference": "af26a91232085b7edd4e04be62f75e7c25159ece"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/9789738bc19af1106dc54d6afba9a0b467516cf2",
- "reference": "9789738bc19af1106dc54d6afba9a0b467516cf2",
+ "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/af26a91232085b7edd4e04be62f75e7c25159ece",
+ "reference": "af26a91232085b7edd4e04be62f75e7c25159ece",
"shasum": ""
},
"require": {
@@ -711,7 +667,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
- "dev-main": "3.7-dev"
+ "dev-main": "3.8-dev"
}
},
"autoload": {
@@ -744,7 +700,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/cache-contracts/tree/v3.7.1"
+ "source": "https://github.com/symfony/cache-contracts/tree/v3.8.1"
},
"funding": [
{
@@ -764,20 +720,20 @@
"type": "tidelift"
}
],
- "time": "2026-06-05T06:23:12+00:00"
+ "time": "2026-09-26T07:05:14+00:00"
},
{
"name": "symfony/deprecation-contracts",
- "version": "v3.7.1",
+ "version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
- "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d"
+ "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d",
- "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/feb1edf4e546af3b85c5caebe8359a20db230ca3",
+ "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3",
"shasum": ""
},
"require": {
@@ -790,7 +746,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
- "dev-main": "3.7-dev"
+ "dev-main": "3.8-dev"
}
},
"autoload": {
@@ -815,7 +771,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.7.1"
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.8.1"
},
"funding": [
{
@@ -835,7 +791,7 @@
"type": "tidelift"
}
],
- "time": "2026-06-05T06:23:12+00:00"
+ "time": "2026-09-16T14:15:10+00:00"
},
{
"name": "symfony/polyfill-mbstring",
@@ -924,16 +880,16 @@
},
{
"name": "symfony/service-contracts",
- "version": "v3.7.3",
+ "version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
- "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257"
+ "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257",
- "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257",
+ "url": "https://api.github.com/repos/symfony/service-contracts/zipball/052852a96fd5e5ebdb617dba22031e41a3300fb5",
+ "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5",
"shasum": ""
},
"require": {
@@ -951,7 +907,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
- "dev-main": "3.7-dev"
+ "dev-main": "3.8-dev"
}
},
"autoload": {
@@ -987,7 +943,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/service-contracts/tree/v3.7.3"
+ "source": "https://github.com/symfony/service-contracts/tree/v3.8.1"
},
"funding": [
{
@@ -1007,20 +963,20 @@
"type": "tidelift"
}
],
- "time": "2026-07-27T15:39:01+00:00"
+ "time": "2026-10-20T17:38:25+00:00"
},
{
"name": "symfony/translation",
- "version": "v6.4.49",
+ "version": "v6.4.50",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "81998c85f03941f8efeb6f44549259066361780b"
+ "reference": "6a2ba8838bb815b90fe09f4487da9896d7128862"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/81998c85f03941f8efeb6f44549259066361780b",
- "reference": "81998c85f03941f8efeb6f44549259066361780b",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/6a2ba8838bb815b90fe09f4487da9896d7128862",
+ "reference": "6a2ba8838bb815b90fe09f4487da9896d7128862",
"shasum": ""
},
"require": {
@@ -1086,7 +1042,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/translation/tree/v6.4.49"
+ "source": "https://github.com/symfony/translation/tree/v6.4.50"
},
"funding": [
{
@@ -1106,20 +1062,20 @@
"type": "tidelift"
}
],
- "time": "2026-10-25T08:57:29+00:00"
+ "time": "2026-11-01T19:42:58+00:00"
},
{
"name": "symfony/translation-contracts",
- "version": "v3.7.1",
+ "version": "v3.8.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
- "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621"
+ "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/ccb206b98faccc511ebae8e5fad50f2dc0b30621",
- "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621",
+ "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0a3ae917402632fcba2aeddae9c98332f3d7dd05",
+ "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05",
"shasum": ""
},
"require": {
@@ -1132,7 +1088,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
- "dev-main": "3.7-dev"
+ "dev-main": "3.8-dev"
}
},
"autoload": {
@@ -1168,7 +1124,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/translation-contracts/tree/v3.7.1"
+ "source": "https://github.com/symfony/translation-contracts/tree/v3.8.1"
},
"funding": [
{
@@ -1188,7 +1144,7 @@
"type": "tidelift"
}
],
- "time": "2026-06-05T06:23:12+00:00"
+ "time": "2026-10-03T08:17:19+00:00"
},
{
"name": "symfony/var-exporter",
@@ -1273,29 +1229,34 @@
},
{
"name": "triangle/engine",
- "version": "v8.1.11",
+ "version": "v9.0.0",
"source": {
"type": "git",
"url": "https://github.com/Triangle-org/Engine.git",
- "reference": "c8e33ca8f90422662e3010746c0bd8292dfac67d"
+ "reference": "4a6dcc03347929a28d44d8b5899bfcae5a98b709"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Triangle-org/Engine/zipball/c8e33ca8f90422662e3010746c0bd8292dfac67d",
- "reference": "c8e33ca8f90422662e3010746c0bd8292dfac67d",
+ "url": "https://api.github.com/repos/Triangle-org/Engine/zipball/4a6dcc03347929a28d44d8b5899bfcae5a98b709",
+ "reference": "4a6dcc03347929a28d44d8b5899bfcae5a98b709",
"shasum": ""
},
"require": {
"ext-intl": "*",
"ext-json": "*",
- "localzet/server": "^4",
- "monolog/monolog": "^2",
+ "localzet/server": "^7.1",
+ "monolog/monolog": "^3.0",
"php": "^8.1",
- "psr/container": "^1.0",
- "symfony/cache": "^6",
- "symfony/translation": "^6"
+ "psr/container": "^1.0|^2.0",
+ "symfony/cache": "~6.4.0",
+ "symfony/translation": "~6.4.0"
+ },
+ "conflict": {
+ "symfony/cache": ">=7.0",
+ "symfony/translation": ">=7.0"
},
"require-dev": {
+ "phpunit/phpunit": "^10.5",
"rector/rector": "*"
},
"suggest": {
@@ -1344,7 +1305,7 @@
"email": "support@localzet.com",
"source": "https://github.com/Triangle-org/Engine"
},
- "time": "2025-11-02T00:43:43+00:00"
+ "time": "2026-11-20T06:19:47+00:00"
}
],
"packages-dev": [],
diff --git a/src/OAuth.php b/src/OAuth.php
index 2d758b5..3211463 100644
--- a/src/OAuth.php
+++ b/src/OAuth.php
@@ -170,7 +170,9 @@ public function getAdapter(string $name): AdapterInterface
}
}
- return new $adapter($config, $this->httpClient, $this->storage, $this->logger);
+ $httpClient = array_key_exists('http_client_options', $config) ? null : $this->httpClient;
+
+ return new $adapter($config, $httpClient, $this->storage, $this->logger);
}
/**
diff --git a/src/OAuth/Adapter/AbstractAdapter.php b/src/OAuth/Adapter/AbstractAdapter.php
index 954e29d..fa3b2b2 100644
--- a/src/OAuth/Adapter/AbstractAdapter.php
+++ b/src/OAuth/Adapter/AbstractAdapter.php
@@ -30,6 +30,7 @@
use InvalidArgumentException;
use localzet\HTTP\Client as HttpClient;
use Monolog\Logger;
+use Psr\Http\Message\ResponseInterface;
use ReflectionClass;
use Support\Collection;
use support\Log;
@@ -38,6 +39,7 @@
use Triangle\Exception\NotImplementedException;
use Triangle\OAuth\Storage\Session;
use Triangle\OAuth\Storage\StorageInterface;
+use Throwable;
/**
* Class AbstractAdapter
@@ -274,12 +276,62 @@ public function setAccessToken($tokens = [])
*/
public function setHttpClient(HttpClient $httpClient = null)
{
+ if ($this->config->exists('curl_options')) {
+ throw new InvalidArgumentException(
+ 'The curl_options setting is no longer supported by localzet/http v3; use http_client_options.'
+ );
+ }
+
+ $options = [];
+ if ($this->config->exists('http_client_options')) {
+ $options = $this->config->get('http_client_options');
+ if (!is_array($options)) {
+ throw new InvalidArgumentException('http_client_options must be an array.');
+ }
+ }
+
+ $this->httpClient = $httpClient ?? new HttpClient($options);
+ }
- $this->httpClient = $httpClient ?: new HttpClient();
+ protected function getCredentialConfig(): Collection
+ {
+ return new Collection($this->config->get('keys'));
+ }
- if ($this->config->exists('curl_options') && method_exists($this->httpClient, 'setCurlOptions')) {
- $this->httpClient->setCurlOptions($this->config->get('curl_options'));
+ protected function requestHttpResponse(
+ string $url,
+ string $method,
+ array $parameters,
+ array $headers,
+ string $error
+ ): ResponseInterface {
+ try {
+ $response = $this->httpClient->request($url, $method, $parameters, $headers);
+ } catch (Throwable $exception) {
+ throw new HttpClientFailureException(
+ $error . '. HTTP client request failed: ' . $exception->getMessage(),
+ 0,
+ $exception,
+ );
}
+
+ if (!$response instanceof ResponseInterface) {
+ throw new HttpClientFailureException($error . '. HTTP client returned no response.');
+ }
+
+ if (!$this->validateApiResponseHttpCode) {
+ return $response;
+ }
+
+ $status = $response->getStatusCode();
+ if ($status < 200 || $status > 299) {
+ throw new HttpRequestFailedException(
+ $error . '. HTTP-ошибка ' . $status . '. Raw Provider API response: '
+ . (string)$response->getBody() . '.'
+ );
+ }
+
+ return $response;
}
/**
@@ -359,41 +411,4 @@ protected function setApiEndpoints($endpoints = null)
$this->authorizeUrl = $collection->get('authorize_url') ?: $this->authorizeUrl;
$this->accessTokenUrl = $collection->get('access_token_url') ?: $this->accessTokenUrl;
}
-
-
- /**
- * Validate signed API responses Http status code.
- *
- * Since the specifics of error responses is beyond the scope of RFC6749 and OAuth Core specifications,
- * Triangle\OAuth will consider any HTTP status code that is different than '200 OK' as an ERROR.
- *
- * @param string $error String to pre append to message thrown in exception
- *
- * @throws HttpClientFailureException
- * @throws HttpRequestFailedException
- */
- protected function validateApiResponse($error = '')
- {
- $error .= !empty($error) ? '. ' : '';
-
- if ($this->httpClient->getResponseClientError()) {
- throw new HttpClientFailureException(
- $error . 'HTTP Client Error.: ' . $this->httpClient->getResponseClientError() . '.'
- );
- }
-
- // if validateApiResponseHttpCode is set to false, we by pass verification of http status code
- if (!$this->validateApiResponseHttpCode) {
- return;
- }
-
- $status = $this->httpClient->getResponseHttpCode();
-
- if ($status < 200 || $status > 299) {
- throw new HttpRequestFailedException(
- $error . 'HTTP-ошибка ' . $this->httpClient->getResponseHttpCode() .
- '. Raw Provider API response: ' . $this->httpClient->getResponseBody() . '.'
- );
- }
- }
}
diff --git a/src/OAuth/Adapter/OAuth1.php b/src/OAuth/Adapter/OAuth1.php
index 2289244..913747c 100644
--- a/src/OAuth/Adapter/OAuth1.php
+++ b/src/OAuth/Adapter/OAuth1.php
@@ -172,8 +172,9 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface
*/
protected function configure()
{
- $this->consumerKey = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key');
- $this->consumerSecret = $this->config->filter('keys')->get('secret');
+ $keys = $this->getCredentialConfig();
+ $this->consumerKey = $keys->get('id') ?: $keys->get('key');
+ $this->consumerSecret = $keys->get('secret');
if (!$this->consumerKey || !$this->consumerSecret) {
throw new InvalidApplicationCredentialsException(
@@ -287,7 +288,7 @@ protected function authenticateBegin()
$this->logger->debug(sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this)), [$authUrl]);
- return redirect($authUrl);
+ return triangle_redirect($authUrl);
}
/**
@@ -623,15 +624,14 @@ protected function oauthRequest($uri, $method = 'GET', $parameters = [], $header
$uri = $request->get_normalized_http_url();
$headers = array_replace($request->to_header(), (array)$headers);
- $response = (string)$this->httpClient->request(
+ $response = $this->requestHttpResponse(
$uri,
$method,
$parameters,
- $headers
+ $headers,
+ 'Signed API request to ' . $uri . ' has returned an error'
);
- $this->validateApiResponse('Signed API request to ' . $uri . ' has returned an error');
-
- return $response;
+ return (string)$response;
}
}
diff --git a/src/OAuth/Adapter/OAuth2.php b/src/OAuth/Adapter/OAuth2.php
index a4e52f7..efba018 100644
--- a/src/OAuth/Adapter/OAuth2.php
+++ b/src/OAuth/Adapter/OAuth2.php
@@ -269,8 +269,9 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface
*/
protected function configure()
{
- $this->clientId = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key');
- $this->clientSecret = $this->config->filter('keys')->get('secret');
+ $keys = $this->getCredentialConfig();
+ $this->clientId = $keys->get('id') ?: $keys->get('key');
+ $this->clientSecret = $keys->get('secret');
if (!$this->clientId || !$this->clientSecret) {
throw new InvalidApplicationCredentialsException(
@@ -417,7 +418,7 @@ protected function authenticateBegin()
$this->logger->debug(sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this)), [$authUrl]);
- return redirect($authUrl);
+ return triangle_redirect($authUrl);
}
/**
@@ -539,16 +540,15 @@ protected function exchangeCodeForAccessToken($code)
{
$this->tokenExchangeParameters['code'] = $code;
- $response = (string)$this->httpClient->request(
+ $response = $this->requestHttpResponse(
$this->accessTokenUrl,
$this->tokenExchangeMethod,
$this->tokenExchangeParameters,
- $this->tokenExchangeHeaders
+ $this->tokenExchangeHeaders,
+ 'Unable to exchange code for API access token'
);
- $this->validateApiResponse('Unable to exchange code for API access token');
-
- return $response;
+ return (string)$response;
}
/**
@@ -651,14 +651,15 @@ public function refreshAccessToken($parameters = [])
return null;
}
- $response = (string)$this->httpClient->request(
+ $httpResponse = $this->requestHttpResponse(
$this->accessTokenUrl,
$this->tokenRefreshMethod,
$this->tokenRefreshParameters,
- $this->tokenRefreshHeaders
+ $this->tokenRefreshHeaders,
+ 'Unable to refresh the access token'
);
- $this->validateApiResponse('Unable to refresh the access token');
+ $response = (string)$httpResponse;
$this->validateRefreshAccessToken($response);
@@ -750,15 +751,14 @@ public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [
$parameters = array_replace($this->apiRequestParameters, (array)$parameters);
$headers = array_replace($this->apiRequestHeaders, (array)$headers);
- $response = (string)$this->httpClient->request(
+ $response = $this->requestHttpResponse(
$url,
$method, // HTTP Request Method. Defaults to GET.
$parameters, // Request Parameters
$headers, // Request Headers
+ 'Signed API request to ' . $url . ' has returned an error'
);
- $this->validateApiResponse('Signed API request to ' . $url . ' has returned an error');
-
- return parse($response);
+ return parse((string)$response);
}
}
diff --git a/src/OAuth/Adapter/OpenID.php b/src/OAuth/Adapter/OpenID.php
index b33d0fd..449bbe2 100644
--- a/src/OAuth/Adapter/OpenID.php
+++ b/src/OAuth/Adapter/OpenID.php
@@ -173,7 +173,7 @@ protected function authenticateBegin()
$this->logger->debug(sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this)), [$authUrl]);
- return redirect($authUrl);
+ return triangle_redirect($authUrl);
}
/**
diff --git a/src/OAuth/Provider/Apple.php b/src/OAuth/Provider/Apple.php
index a5dd86b..808eedc 100644
--- a/src/OAuth/Provider/Apple.php
+++ b/src/OAuth/Provider/Apple.php
@@ -269,7 +269,8 @@ public function getUserProfile()
private function getSecret()
{
// Your 10-character Team ID
- $team_id = $this->config->filter('keys')->get('team_id');
+ $keys = $this->getCredentialConfig();
+ $team_id = $keys->get('team_id');
if (!$team_id) {
throw new InvalidApplicationCredentialsException(
@@ -278,7 +279,7 @@ private function getSecret()
}
// Your Services ID, e.g. com.aaronparecki.services
- $client_id = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key');
+ $client_id = $keys->get('id') ?: $keys->get('key');
if (!$client_id) {
throw new InvalidApplicationCredentialsException(
@@ -287,7 +288,7 @@ private function getSecret()
}
// Find the 10-char Key ID value from the portal
- $key_id = $this->config->filter('keys')->get('key_id');
+ $key_id = $keys->get('key_id');
if (!$key_id) {
throw new InvalidApplicationCredentialsException(
@@ -296,11 +297,11 @@ private function getSecret()
}
// Find the 10-char Key ID value from the portal
- $key_content = $this->config->filter('keys')->get('key_content');
+ $key_content = $keys->get('key_content');
// Save your private key from Apple in a file called `key.txt`
if (!$key_content) {
- $key_file = $this->config->filter('keys')->get('key_file');
+ $key_file = $keys->get('key_file');
if (!$key_file) {
throw new InvalidApplicationCredentialsException(
diff --git a/src/OAuth/Provider/ESIA.php b/src/OAuth/Provider/ESIA.php
index 5245e36..16a03d4 100644
--- a/src/OAuth/Provider/ESIA.php
+++ b/src/OAuth/Provider/ESIA.php
@@ -59,7 +59,8 @@ protected function configure()
);
- $this->clientId = $this->config->filter('keys')->get('id');
+ $keys = $this->getCredentialConfig();
+ $this->clientId = $keys->get('id');
$this->clientSecret = $this->signature($this->scope . $this->timestamp . $this->clientId . $this->state);
if (!$this->clientId || !$this->clientSecret) {
@@ -87,13 +88,14 @@ protected function signature(string $message)
set_error_handler(function (int $errno, string $errstr) {
throw new RuntimeException("Не могу прочитать сертификат ($errno): $errstr");
});
- $cert = openssl_x509_read(file_get_contents($this->config->filter('keys')->get('cert')));
+ $cert = openssl_x509_read(file_get_contents($this->getCredentialConfig()->get('cert')));
} finally {
restore_error_handler();
if (!is_resource($cert)) throw new RuntimeException(openssl_error_string());
}
- $privateKey = openssl_pkey_get_private(file_get_contents($this->config->filter('keys')->get('key')), $this->config->filter('keys')->get('key_pass'));
+ $keys = $this->getCredentialConfig();
+ $privateKey = openssl_pkey_get_private(file_get_contents($keys->get('key')), $keys->get('key_pass'));
if (!is_resource($privateKey)) {
throw new RuntimeException("Не могу прочитать приватный ключ");
}
diff --git a/src/OAuth/Provider/Facebook.php b/src/OAuth/Provider/Facebook.php
index 0ecaf9f..37c2702 100644
--- a/src/OAuth/Provider/Facebook.php
+++ b/src/OAuth/Provider/Facebook.php
@@ -150,14 +150,15 @@ public function exchangeAccessToken()
'fb_exchange_token' => $this->getStoredData('access_token'),
];
- $response = (string)$this->httpClient->request(
+ $response = $this->requestHttpResponse(
$this->accessTokenUrl,
'GET',
- $exchangeTokenParameters
+ $exchangeTokenParameters,
+ [],
+ 'Unable to exchange the access token'
);
- $this->validateApiResponse('Unable to exchange the access token');
-
+ $response = (string)$response;
$this->validateAccessTokenExchange($response);
return $response;
diff --git a/src/OAuth/Provider/Instagram.php b/src/OAuth/Provider/Instagram.php
index 0f1a7b3..b594a5c 100644
--- a/src/OAuth/Provider/Instagram.php
+++ b/src/OAuth/Provider/Instagram.php
@@ -150,14 +150,15 @@ public function exchangeAccessToken()
$url = 'https://graph.instagram.com/access_token';
}
- $response = (string)$this->httpClient->request(
+ $response = $this->requestHttpResponse(
$url,
'GET',
- $exchangeTokenParameters
+ $exchangeTokenParameters,
+ [],
+ 'Unable to exchange the access token'
);
- $this->validateApiResponse('Unable to exchange the access token');
-
+ $response = (string)$response;
$this->validateAccessTokenExchange($response);
return $response;
diff --git a/src/OAuth/Provider/PaypalOpenID.php b/src/OAuth/Provider/PaypalOpenID.php
index 0a77976..40ecb35 100644
--- a/src/OAuth/Provider/PaypalOpenID.php
+++ b/src/OAuth/Provider/PaypalOpenID.php
@@ -84,6 +84,6 @@ public function authenticateBegin()
'company/title',
];
- return redirect($this->openIdClient->authUrl());
+ return triangle_redirect($this->openIdClient->authUrl());
}
}
diff --git a/src/OAuth/Provider/Steam.php b/src/OAuth/Provider/Steam.php
index f231104..5cad583 100644
--- a/src/OAuth/Provider/Steam.php
+++ b/src/OAuth/Provider/Steam.php
@@ -83,7 +83,7 @@ public function authenticateFinish()
}
try {
- $apiKey = $this->config->filter('keys')->get('secret');
+ $apiKey = $this->getCredentialConfig()->get('secret');
// if api key is provided, we attempt to use steam web api
if ($apiKey) {
diff --git a/src/OAuth/Provider/Telegram.php b/src/OAuth/Provider/Telegram.php
index a1a2d2d..8ab7573 100644
--- a/src/OAuth/Provider/Telegram.php
+++ b/src/OAuth/Provider/Telegram.php
@@ -89,8 +89,9 @@ class Telegram extends AbstractAdapter implements AdapterInterface
*/
protected function configure()
{
- $this->botId = $this->config->filter('keys')->get('id');
- $this->botSecret = $this->config->filter('keys')->get('secret');
+ $keys = $this->getCredentialConfig();
+ $this->botId = $keys->get('id');
+ $this->botSecret = $keys->get('secret');
$this->callbackUrl = $this->config->get('callback');
if (!$this->botId || !$this->botSecret) {
@@ -209,7 +210,7 @@ protected function authenticateBegin()
$nonce = $this->config->get('nonce');
$nonce_code = empty($nonce) ? '' : "nonce=\"{$nonce}\"";
- return response(
+ return triangle_response(
<<