From dd5955b4cc497bc6b4f3315b82fb96d766233602 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 29 Jan 2021 13:46:06 +0100 Subject: [PATCH 01/68] Releases version 3.0.2 - resolves #96 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c67ebb6..6e26a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.2] - 2021-01-29 ### Added - PHP-8 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..4590b54 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.2'; public function smsapiPlService(string $apiToken): SmsapiPlService; From fb2272a324a6b60b29086dbad42a910a57df2576 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 19 Jul 2021 09:04:01 +0200 Subject: [PATCH 02/68] Adds api token to test configuration example file --- tests-resources/config/config.dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests-resources/config/config.dist.yml b/tests-resources/config/config.dist.yml index c3da0b8..9d15135 100644 --- a/tests-resources/config/config.dist.yml +++ b/tests-resources/config/config.dist.yml @@ -1,3 +1,4 @@ Service name: SMSAPI.PL API URI: https://api.smsapi.pl +API token: 0000000000000000000000000000000000000000 logger: false From ab9b9fe3b430f2d6c3fe71bd6e7dc1abc915e79c Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 19 Jul 2021 11:15:03 +0200 Subject: [PATCH 03/68] Describes how to run tests --- Makefile | 8 +++++++- Makefile.php8 | 8 ++++++++ README.md | 39 ++++++++++++++++++++++++++++++++++++--- docker-compose.yml | 7 +++++++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 Makefile.php8 diff --git a/Makefile b/Makefile index 199e534..615ee88 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ .PHONY: help help: - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + @grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ + | sort \ + | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + + +include Makefile.php8 + .DEFAULT_GOAL := help diff --git a/Makefile.php8 b/Makefile.php8 new file mode 100644 index 0000000..708010a --- /dev/null +++ b/Makefile.php8 @@ -0,0 +1,8 @@ +prepare-php8: ## load dependencies + docker-compose run -T php8 /usr/bin/composer update + +test-php8: prepare-php8 ## run test + docker-compose run -T php8 php vendor/bin/phpunit --configuration phpunit.xml + +test-suite-php8: prepare-php8 ## run test against suite, ex: make test-suite SUITE="unit" + docker-compose run -T php8 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/README.md b/README.md index 4f144c0..58219b3 100644 --- a/README.md +++ b/README.md @@ -268,9 +268,42 @@ $logger = new class() implements LoggerInterface $client->setLogger($logger); ``` -## Test package -1. Download package: `composer create-project smsapi/php-client` -2. Execute tests: `./vendor/bin/phpunit --configuration phpunit.dist.xml` +## How to test package + +Copy `phpunit.dist.xml` to `phpunit.xml`. You may adjust it to your needs then. + +Copy `tests-resources/config/config.dist.yml` to `tests-resources/config/config.yml`. Fill in SMSAPI service connection data. + +### How to run unit tests + +Unit tests are included into package build process and run against its current version on every commit (see `.travis.yml`). +You can run those tests locally with ease using provided Docker configuration, simply run: + +```shell +make test-suite SUITE="unit" +``` + +### How to run integration tests + +Note that integration test works within an account you have configured in `tests-resources/config/config.yml`. +Although those test have been written to self-cleanup on exit, in case of failure some trash data may stay. +Use it with caution. + +```shell +make test-suite SUITE="integration" +``` + +### How to run feature tests + +Feature test groups are defined in `phpunit.dist.xml`. To run tests execute: + +```shell +make test-suite SUITE="feature-contacts" +``` + +### How to run tests against PHP8 + +To run any of mentioned above against PHP8 use make targets with `php8` suffix. See `Makefile.php8`. ## Docs & Infos * [SMSAPI.COM API documentation](https://www.smsapi.com/docs) diff --git a/docker-compose.yml b/docker-compose.yml index f669f77..f0636d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,3 +7,10 @@ services: - .:/app network_mode: host + php8: + build: + context: . + dockerfile: Dockerfile.php8 + volumes: + - .:/app + network_mode: host \ No newline at end of file From 4723a380eb179124d6c940218c8ea55beeb43d1b Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 19 Jul 2021 12:51:48 +0200 Subject: [PATCH 04/68] Makes all errors verbose --- phpunit.dist.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpunit.dist.xml b/phpunit.dist.xml index 95cb746..4719765 100644 --- a/phpunit.dist.xml +++ b/phpunit.dist.xml @@ -67,4 +67,10 @@ tests/Integration/Feature/Blacklist + + + + + + From 2567ef7ca7d77677b5405bcd9a30660eb9bb61ad Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 19 Jul 2021 13:23:07 +0200 Subject: [PATCH 05/68] Fixes Guzzle PSR7 lib incompatible URI paths --- CHANGELOG.md | 4 ++++ .../HttpClient/Decorator/BaseUriDecorator.php | 7 ++++--- src/SmsapiClient.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e26a30..07ec04e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Guzzle PSR7 incompatible URI paths, `The path of a URI with an authority must start with a slash "/" or be empty` + ## [3.0.2] - 2021-01-29 ### Added - PHP-8 support diff --git a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php index 4747292..75b50db 100644 --- a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php +++ b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php @@ -37,11 +37,12 @@ private function prependBaseUri(RequestInterface $request): RequestInterface $scheme = $baseUriParts['scheme'] ?? ''; $host = $baseUriParts['host'] ?? ''; - $path = $baseUriParts['path'] ?? ''; + $basePath = $baseUriParts['path'] ?? ''; + $basePath = rtrim($basePath, '/'); - $uri = $uri->withScheme($scheme); + $uri = $uri->withPath($basePath . '/' . $uri->getPath()); $uri = $uri->withHost($host); - $uri = $uri->withPath($path . $uri->getPath()); + $uri = $uri->withScheme($scheme); return $request->withUri($uri); } diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 4590b54..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.2'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 762a7fd977a1ad0d57e802e71ff21ac6abaf0e89 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 21 Jul 2021 14:06:02 +0200 Subject: [PATCH 06/68] Releases version 3.0.3 - resolves #99 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ec04e..ab4c24c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.3] - 2021-07-21 ### Fixed - Guzzle PSR7 incompatible URI paths, `The path of a URI with an authority must start with a slash "/" or be empty` diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..a4b592a 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.3'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 2c9e2b0d9ebe8c41e449b997e23b70648cb89c79 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Wed, 15 Sep 2021 19:11:40 +0200 Subject: [PATCH 07/68] Update psr\log --- .gitignore | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2a0d621..706bbf6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /composer.lock /phpunit.xml /composer.phar +.phpunit.result.cache diff --git a/composer.json b/composer.json index 330fa8f..67cee8b 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7 || ^8.0", "ext-json": "*", - "psr/log": "^1", + "psr/log": "^1 || ^2 || ^3", "psr/http-message": "^1", "psr/http-client": "^1", "psr/http-factory": "^1" From c8b9a97c6a7dc586570c5c7efabc9ca246515cc2 Mon Sep 17 00:00:00 2001 From: SMSAPI Date: Thu, 13 Jan 2022 10:02:13 +0100 Subject: [PATCH 08/68] Update README.md Added info how to use smsapi.se and smsapi.bg services --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 58219b3..3f74457 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ $apiToken = '0000000000000000000000000000000000000000'; $service = $client->smsapiPlService($apiToken); ``` -## How to use a service with custom URI? +### How to use *SMSAPI.SE* or *SMSAPI.BG* services? ```php smsapiComServiceWithUri($apiToken, $uri); ``` @@ -308,7 +308,11 @@ To run any of mentioned above against PHP8 use make targets with `php8` suffix. ## Docs & Infos * [SMSAPI.COM API documentation](https://www.smsapi.com/docs) * [SMSAPI.PL API documentation](https://www.smsapi.pl/docs) -* [Repository on GitHub](https://github.com/smsapi/smsapi-php-client) -* [Package on Packagist](https://packagist.org/packages/smsapi/php-client) +* [SMSAPI.SE API documentation](https://www.smsapi.se/docs) +* [SMSAPI.BG API documentation](https://www.smsapi.bg/docs) * [SMSAPI.COM web page](https://smsapi.com) * [SMSAPI.PL web page](https://smsapi.pl) +* [SMSAPI.SE web page](https://smsapi.se) +* [SMSAPI.BG web page](https://smsapi.bg) +* [Repository on GitHub](https://github.com/smsapi/smsapi-php-client) +* [Package on Packagist](https://packagist.org/packages/smsapi/php-client) From 45a562708eca51003a6e54e61ca6fc30720b70f9 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Tue, 11 Jan 2022 16:37:59 +0100 Subject: [PATCH 09/68] Run test with github actions --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++++++++++ .travis.yml | 12 ---------- 2 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..33d583a --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,46 @@ +name: Tests + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + tests: + name: PHP ${{ matrix.php }} / ${{ matrix.dependency-version }} + runs-on: ubuntu-latest + strategy: + matrix: + php: + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }} + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction + + - name: Running unit tests + run: php vendor/bin/phpunit --configuration phpunit.dist.xml --testsuite unit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6da4a7b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php -php: -- '7.0' -- '7.1' -- '7.2' -- '7.3' -- '7.4' -- '8.0' -before_script: -- composer self-update -- composer install -script: ./vendor/bin/phpunit --configuration phpunit.dist.xml --testsuite unit From 62dbcc85d0b04609303b81e5abd6dda75ba9f49c Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Fri, 14 Jan 2022 13:50:44 +0100 Subject: [PATCH 10/68] Fix for php 8 on integration tests --- src/Curl/SmsapiHttpClient.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Curl/SmsapiHttpClient.php b/src/Curl/SmsapiHttpClient.php index 349ac5d..c6cdbd6 100644 --- a/src/Curl/SmsapiHttpClient.php +++ b/src/Curl/SmsapiHttpClient.php @@ -4,6 +4,7 @@ namespace Smsapi\Client\Curl; +use Psr\Log\LoggerAwareTrait; use Psr\Log\LoggerInterface; use Smsapi\Client\Curl\Discovery\CurlDiscovery; use Smsapi\Client\Curl\Discovery\GuzzleHttpHelpersDiscovery; @@ -16,6 +17,8 @@ */ class SmsapiHttpClient implements SmsapiClient { + use LoggerAwareTrait; + private $httpClient; public function __construct() @@ -30,28 +33,30 @@ public function __construct() ); } - public function setLogger(LoggerInterface $logger) - { - $this->httpClient->setLogger($logger); - } - public function smsapiPlService(string $apiToken): SmsapiPlService { - return $this->httpClient->smsapiPlService($apiToken); + return $this->httpClient()->smsapiPlService($apiToken); } public function smsapiPlServiceWithUri(string $apiToken, string $uri): SmsapiPlService { - return $this->httpClient->smsapiPlServiceWithUri($apiToken, $uri); + return $this->httpClient()->smsapiPlServiceWithUri($apiToken, $uri); } public function smsapiComService(string $apiToken): SmsapiComService { - return $this->httpClient->smsapiComService($apiToken); + return $this->httpClient()->smsapiComService($apiToken); } public function smsapiComServiceWithUri(string $apiToken, string $uri): SmsapiComService { - return $this->httpClient->smsapiComServiceWithUri($apiToken, $uri); + return $this->httpClient()->smsapiComServiceWithUri($apiToken, $uri); + } + + private function httpClient(): \Smsapi\Client\SmsapiHttpClient + { + $this->httpClient->setLogger($this->logger); + + return $this->httpClient; } -} \ No newline at end of file +} From c9ffdb1dc562707e87d88fea28b91094fcb48ed1 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Fri, 14 Jan 2022 13:56:18 +0100 Subject: [PATCH 11/68] Check that logger is null before set --- src/Curl/SmsapiHttpClient.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Curl/SmsapiHttpClient.php b/src/Curl/SmsapiHttpClient.php index c6cdbd6..ddac39b 100644 --- a/src/Curl/SmsapiHttpClient.php +++ b/src/Curl/SmsapiHttpClient.php @@ -55,7 +55,9 @@ public function smsapiComServiceWithUri(string $apiToken, string $uri): SmsapiCo private function httpClient(): \Smsapi\Client\SmsapiHttpClient { - $this->httpClient->setLogger($this->logger); + if ($this->logger instanceof LoggerInterface) { + $this->httpClient->setLogger($this->logger); + } return $this->httpClient; } From d48a4625397d87413040b3dfd39830ed5867c06e Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Mon, 17 Jan 2022 14:30:32 +0100 Subject: [PATCH 12/68] Remove test logger --- tests-resources/config/config.dist.yml | 1 - tests-resources/config/config.yml.example | 1 - tests/SmsapiClientIntegrationTestCase.php | 4 --- tests/TestLogger.php | 37 ----------------------- 4 files changed, 43 deletions(-) delete mode 100644 tests/TestLogger.php diff --git a/tests-resources/config/config.dist.yml b/tests-resources/config/config.dist.yml index 9d15135..7f9437f 100644 --- a/tests-resources/config/config.dist.yml +++ b/tests-resources/config/config.dist.yml @@ -1,4 +1,3 @@ Service name: SMSAPI.PL API URI: https://api.smsapi.pl API token: 0000000000000000000000000000000000000000 -logger: false diff --git a/tests-resources/config/config.yml.example b/tests-resources/config/config.yml.example index ffbe66d..f93b66c 100644 --- a/tests-resources/config/config.yml.example +++ b/tests-resources/config/config.yml.example @@ -1,4 +1,3 @@ Service name: "SMSAPI.PL" OR "SMSAPI.COM" API token: 40-characters length string generated in SMSAPI Panel API URI: "https://api.smsapi.pl", "https://api.smsapi.com", "https://api2.smsapi.pl" or "https://api2.smsapi.com" -logger: true diff --git a/tests/SmsapiClientIntegrationTestCase.php b/tests/SmsapiClientIntegrationTestCase.php index 6c547c8..a3a5337 100644 --- a/tests/SmsapiClientIntegrationTestCase.php +++ b/tests/SmsapiClientIntegrationTestCase.php @@ -33,10 +33,6 @@ public static function prepare() $smsapiHttpClient = new SmsapiHttpClient(); - if (Config::get('logger')) { - $smsapiHttpClient->setLogger(new TestLogger()); - } - $serviceName = Config::get('Service name'); if ($serviceName === ServiceName::SMSAPI_PL) { self::$smsapiService = $smsapiHttpClient->smsapiPlServiceWithUri(self::$apiToken, $apiUri); diff --git a/tests/TestLogger.php b/tests/TestLogger.php deleted file mode 100644 index 3ff6519..0000000 --- a/tests/TestLogger.php +++ /dev/null @@ -1,37 +0,0 @@ - $value) { - if ($value instanceof RequestInterface) { - $context[$item] = [ - 'headers' => $value->getHeaders(), - 'uri' => $value->getUri()->__toString(), - 'method' => $value->getMethod(), - 'contents' => $value->getBody()->__toString(), - ]; - } elseif ($value instanceof ResponseInterface) { - $context[$item] = [ - 'headers' => $value->getHeaders(), - 'status_code' => $value->getStatusCode(), - 'contents' => $value->getBody()->__toString(), - ]; - } - } - - echo sprintf("[%s] %s (%s)\n", $level, $message, print_r($context)); - } -} From 615dc42d8b5497614b34ba4e1e2fc5a3f453a905 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 17 Jan 2022 16:18:56 +0100 Subject: [PATCH 13/68] Releases version 3.0.4 - resolves #100 --- CHANGELOG.md | 4 ++++ src/SmsapiClient.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4c24c..1d8b9ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.0.4] - 2022-01-17 +### Added +- `psr/log` v2, v3 support + ## [3.0.3] - 2021-07-21 ### Fixed - Guzzle PSR7 incompatible URI paths, `The path of a URI with an authority must start with a slash "/" or be empty` diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index a4b592a..113101c 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.3'; + const VERSION = '3.0.4'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 09243027ae915915a5b33be593f7ec976c14c368 Mon Sep 17 00:00:00 2001 From: Kyryl Bogach Date: Tue, 22 Mar 2022 14:19:57 +0100 Subject: [PATCH 14/68] Fix headers parsing of HttpClient --- src/Curl/HttpClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Curl/HttpClient.php b/src/Curl/HttpClient.php index d068cf5..eaaaca1 100644 --- a/src/Curl/HttpClient.php +++ b/src/Curl/HttpClient.php @@ -88,7 +88,7 @@ private function execute(RequestInterface $request, $httpClient): ResponseInterf $headerSize = curl_getinfo($httpClient, CURLINFO_HEADER_SIZE); $headerString = substr($response, 0, $headerSize); - $headers = array_filter(explode("\n", $headerString), 'trim'); + $headers = array_filter(array_map('trim', explode("\n", $headerString))); $body = substr($response, $headerSize); @@ -99,4 +99,4 @@ private function closeHttpClient($httpClient) { curl_close($httpClient); } -} \ No newline at end of file +} From 12dea755fdc26861bdab26f092ab5b6e9bf4612d Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 23 Mar 2022 10:44:51 +0100 Subject: [PATCH 15/68] Releases version 3.0.5 - resolves #120 --- CHANGELOG.md | 4 ++++ src/SmsapiClient.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d8b9ae..c57859e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.0.5] - 2022-03-23 +### Fixed +- HTTP headers parsing, `HttpClient` issue + ## [3.0.4] - 2022-01-17 ### Added - `psr/log` v2, v3 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 113101c..7561a9e 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.4'; + const VERSION = '3.0.5'; public function smsapiPlService(string $apiToken): SmsapiPlService; From b50149800640df360e535d8eaa57b005f2f184b1 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Thu, 24 Mar 2022 11:26:06 +0100 Subject: [PATCH 16/68] Fixes HTTP headers parsing of built-in HttpClient, PSR-7 compatibility issue --- CHANGELOG.md | 4 + src/Curl/HttpClient.php | 2 +- src/Curl/HttpHeadersParser.php | 23 +++++ .../HttpClient/Decorator/LoggerDecorator.php | 9 +- src/SmsapiClient.php | 2 +- tests/Unit/Curl/HttpHeadersParserTest.php | 85 +++++++++++++++++++ 6 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/Curl/HttpHeadersParser.php create mode 100644 tests/Unit/Curl/HttpHeadersParserTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c57859e..24a4711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- HTTP headers parsing, PSR-7 compliant + ## [3.0.5] - 2022-03-23 ### Fixed - HTTP headers parsing, `HttpClient` issue diff --git a/src/Curl/HttpClient.php b/src/Curl/HttpClient.php index eaaaca1..b2f9af7 100644 --- a/src/Curl/HttpClient.php +++ b/src/Curl/HttpClient.php @@ -88,7 +88,7 @@ private function execute(RequestInterface $request, $httpClient): ResponseInterf $headerSize = curl_getinfo($httpClient, CURLINFO_HEADER_SIZE); $headerString = substr($response, 0, $headerSize); - $headers = array_filter(array_map('trim', explode("\n", $headerString))); + $headers = HttpHeadersParser::parse($headerString); $body = substr($response, $headerSize); diff --git a/src/Curl/HttpHeadersParser.php b/src/Curl/HttpHeadersParser.php new file mode 100644 index 0000000..9ae2d69 --- /dev/null +++ b/src/Curl/HttpHeadersParser.php @@ -0,0 +1,23 @@ +logger->info('Request', [ + 'request' => $request, 'method' => $request->getMethod(), 'uri' => $request->getUri(), + 'headers' => $request->getHeaders(), + 'body' => $request->getBody()->getContents(), ]); $response = $this->client->sendRequest($request); - $this->logger->info('Response', ['response' => $response]); + $this->logger->info('Response', [ + 'response' => $response, + 'headers' => $response->getHeaders(), + 'body' => $response->getBody()->getContents(), + ]); return $response; } diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 7561a9e..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.5'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; diff --git a/tests/Unit/Curl/HttpHeadersParserTest.php b/tests/Unit/Curl/HttpHeadersParserTest.php new file mode 100644 index 0000000..cdfdbd8 --- /dev/null +++ b/tests/Unit/Curl/HttpHeadersParserTest.php @@ -0,0 +1,85 @@ +assertArrayNotHasKey('HTTP/1.1 202 OK', $headers); + $this->assertNotContains('HTTP/1.1 202 OK', $headers); + } + + /** + * @test + */ + public function not_bypass_non_http_status_line_first_line() + { + $rawHeaders = "Header1: any\r\nHeader2: any, other\r\n"; + + $headers = HttpHeadersParser::parse($rawHeaders); + + $this->assertArrayHasKey('Header1', $headers); + } + + /** + * @test + */ + public function bypass_empty_line() + { + $rawHeaders = "HTTP/1.1 202 OK\r\nHeader1: any\r\nHeader2: any, other\r\n\r\n"; + + $headers = HttpHeadersParser::parse($rawHeaders); + + $this->assertCount(2, array_keys($headers)); + } + + /** + * @test + */ + public function add_all_headers() + { + $rawHeaders = "HTTP/1.1 202 OK\r\nHeader1: any\r\nHeader2: any, other\r\n"; + + $headers = HttpHeadersParser::parse($rawHeaders); + + $this->assertArrayHasKey('Header1', $headers); + $this->assertArrayHasKey('Header2', $headers); + } + + /** + * @test + */ + public function add_single_value_headers() + { + $rawHeaders = "HTTP/1.1 202 OK\r\nHeader1: any\r\nHeader2: any, other\r\n"; + + $headers = HttpHeadersParser::parse($rawHeaders); + + $this->assertEquals('any', $headers['Header1']); + } + + /** + * @test + */ + public function add_multi_value_headers() + { + $rawHeaders = "HTTP/1.1 202 OK\r\nHeader1: any\r\nHeader2: any, other\r\n"; + + $headers = HttpHeadersParser::parse($rawHeaders); + + $this->assertEquals('any, other', $headers['Header2']); + } +} \ No newline at end of file From 499af0b02cb8e07aa4774d85cc295a66141b69a4 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 28 Mar 2022 11:58:20 +0200 Subject: [PATCH 17/68] Releases version 3.0.6 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24a4711..9e48f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.6] - 2022-03-28 ### Fixed - HTTP headers parsing, PSR-7 compliant diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..6f6c0b5 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.6'; public function smsapiPlService(string $apiToken): SmsapiPlService; From bda0b2d948cf5fb56af4de486c93530f68584ae2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 25 May 2022 16:21:54 +0200 Subject: [PATCH 18/68] Sets Composer to 2.2 LTS as Composer 2.3.0 dropped support for PHP <7.2.5. Mitigates CVE-2022-24828. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f1bf11c..2962bf0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:latest as composer +FROM composer:2.2 as composer FROM php:7.0-cli-alpine RUN apk update && \ From d23aead0d6f27b71152c15c6eda8e866f99bef1f Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 4 Nov 2022 12:49:02 +0100 Subject: [PATCH 19/68] Fixes MFA feature integration tests --- tests/Integration/Feature/Mfa/MfaFeatureTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Integration/Feature/Mfa/MfaFeatureTest.php b/tests/Integration/Feature/Mfa/MfaFeatureTest.php index 7fdbc3c..1a01cfb 100644 --- a/tests/Integration/Feature/Mfa/MfaFeatureTest.php +++ b/tests/Integration/Feature/Mfa/MfaFeatureTest.php @@ -32,7 +32,7 @@ public function it_should_create_mfa() /** * @test */ - public function it_should_not_create_mfa_for_an_ivalid_mobile_phone_number() + public function it_should_not_create_mfa_for_an_invalid_mobile_phone_number() { //given $mfaFeature = self::$smsapiService->mfaFeature(); @@ -97,7 +97,7 @@ public function it_should_not_verify_invalid_code() { //given $mfaFeature = self::$smsapiService->mfaFeature(); - $verificationMfaBag = new VerificationMfaBag('123 456', PhoneNumberFixture::anyValidMobile()); + $verificationMfaBag = new VerificationMfaBag('invalid', PhoneNumberFixture::anyValidMobile()); //expect $this->expectException(SmsapiClientException::class); $this->expectExceptionMessage('MFA code has invalid format'); From d93ffcc77d51818a6aeff6f96f4130d58b1615e2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 4 Nov 2022 13:02:42 +0100 Subject: [PATCH 20/68] Marks as unreleased --- CHANGELOG.md | 2 ++ src/SmsapiClient.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e48f8b..67f292b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + ## [3.0.6] - 2022-03-28 ### Fixed - HTTP headers parsing, PSR-7 compliant diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 6f6c0b5..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.6'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 8f755c5f3448ac5df44079953d2b3758b930a840 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 15 Nov 2022 11:40:11 +0100 Subject: [PATCH 21/68] Adds git attributes --- .gitattributes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cd2ecfe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +/.github export-ignore +/tests export-ignore +/tests-resources export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.docker-compose.yml export-ignore +/Dockerfile export-ignore +/Dockerfile.php8 export-ignore +/Makefile export-ignore +/Makefile.php8 export-ignore +/phpcs.xml export-ignore +/phpunit.dist.xml export-ignore + +*.php diff=php \ No newline at end of file From a70a0fe737d6b22792eb3b3b4730bbcde55392a4 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 15 Nov 2022 12:30:55 +0100 Subject: [PATCH 22/68] Adds security advisories --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 67cee8b..f477dee 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "phpdocumentor/reflection-docblock": "^4.3 || ^5.2.0", "phpdocumentor/type-resolver": "^0.5 || ^1.3.0", "guzzlehttp/psr7": "^1", - "ext-curl": "*" + "ext-curl": "*", + "roave/security-advisories": "dev-latest" }, "suggest": { "ext-curl": "To use Curl HttpClient", From 205786d4ed1579117490af8058e62e62ec74dcb2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 15 Nov 2022 15:50:26 +0100 Subject: [PATCH 23/68] Extracts build assets to separate directory --- .gitattributes | 8 +------ .github/workflows/tests.yml | 2 +- .gitignore | 1 - Makefile | 21 ------------------ Makefile.php8 | 8 ------- build/Makefile | 22 +++++++++++++++++++ build/docker-compose.yml | 17 ++++++++++++++ Dockerfile => build/php-7.0/Dockerfile | 0 build/php-7.0/Makefile | 10 +++++++++ Dockerfile.php8 => build/php-8.0/Dockerfile | 0 build/php-8.0/Makefile | 10 +++++++++ docker-compose.yml | 16 -------------- phpcs.xml | 17 -------------- .../phpunit.dist.xml | 0 14 files changed, 61 insertions(+), 71 deletions(-) delete mode 100644 Makefile delete mode 100644 Makefile.php8 create mode 100644 build/Makefile create mode 100644 build/docker-compose.yml rename Dockerfile => build/php-7.0/Dockerfile (100%) create mode 100644 build/php-7.0/Makefile rename Dockerfile.php8 => build/php-8.0/Dockerfile (100%) create mode 100644 build/php-8.0/Makefile delete mode 100644 docker-compose.yml delete mode 100644 phpcs.xml rename phpunit.dist.xml => tests-resources/phpunit.dist.xml (100%) diff --git a/.gitattributes b/.gitattributes index cd2ecfe..1754c28 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,14 +1,8 @@ /.github export-ignore +/build export-ignore /tests export-ignore /tests-resources export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.docker-compose.yml export-ignore -/Dockerfile export-ignore -/Dockerfile.php8 export-ignore -/Makefile export-ignore -/Makefile.php8 export-ignore -/phpcs.xml export-ignore -/phpunit.dist.xml export-ignore *.php diff=php \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 33d583a..6d4fa90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,4 +43,4 @@ jobs: run: composer update --prefer-dist --no-interaction - name: Running unit tests - run: php vendor/bin/phpunit --configuration phpunit.dist.xml --testsuite unit + run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit diff --git a/.gitignore b/.gitignore index 706bbf6..0ba02c9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ /vendor /composer.lock /phpunit.xml -/composer.phar .phpunit.result.cache diff --git a/Makefile b/Makefile deleted file mode 100644 index 615ee88..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -.PHONY: help - -help: - @grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ - | sort \ - | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - - -include Makefile.php8 - - -.DEFAULT_GOAL := help - -prepare: ## load dependencies - docker-compose run -T php /usr/bin/composer update - -test: prepare ## run test - docker-compose run -T php php vendor/bin/phpunit --configuration phpunit.xml - -test-suite: prepare ## run test against suite, ex: make test-suite SUITE="unit" - docker-compose run -T php php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/Makefile.php8 b/Makefile.php8 deleted file mode 100644 index 708010a..0000000 --- a/Makefile.php8 +++ /dev/null @@ -1,8 +0,0 @@ -prepare-php8: ## load dependencies - docker-compose run -T php8 /usr/bin/composer update - -test-php8: prepare-php8 ## run test - docker-compose run -T php8 php vendor/bin/phpunit --configuration phpunit.xml - -test-suite-php8: prepare-php8 ## run test against suite, ex: make test-suite SUITE="unit" - docker-compose run -T php8 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..75050a5 --- /dev/null +++ b/build/Makefile @@ -0,0 +1,22 @@ +.PHONY: help build test + +include $(CURDIR)/php-7.0/Makefile +include $(CURDIR)/php-8.0/Makefile + +help: + @grep -hE '^[a-zA-Z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \ + | sort \ + | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +build: ## build php images + docker-compose build + +test: ## test all against all php images + $(MAKE) test-php-7.0 + $(MAKE) test-php-8.0 + +test-unit: ## test unit suite against all php images + $(MAKE) test-suite-php-7.0 SUITE=unit + $(MAKE) test-suite-php-8.0 SUITE=unit + +.DEFAULT_GOAL := help diff --git a/build/docker-compose.yml b/build/docker-compose.yml new file mode 100644 index 0000000..d65f1c9 --- /dev/null +++ b/build/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.5' + +services: + + php-7.0: + build: + context: php-7.0 + volumes: + - ..:/app + network_mode: host + + php-8.0: + build: + context: php-8.0 + volumes: + - ..:/app + network_mode: host \ No newline at end of file diff --git a/Dockerfile b/build/php-7.0/Dockerfile similarity index 100% rename from Dockerfile rename to build/php-7.0/Dockerfile diff --git a/build/php-7.0/Makefile b/build/php-7.0/Makefile new file mode 100644 index 0000000..50000f8 --- /dev/null +++ b/build/php-7.0/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-7.0 test-php-7.0 test-suite-php-7.0 + +prepare-php-7.0: ## load dependencies with php 7.0 + docker-compose run -T php-7.0 /usr/bin/composer update + +test-php-7.0: prepare-php-7.0 ## run tests against php 7.0 + docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration phpunit.xml + +test-suite-php-7.0: prepare-php-7.0 ## run suite tests against php 7.0, ex: make test-suite-php-7.0 SUITE="unit" + docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/Dockerfile.php8 b/build/php-8.0/Dockerfile similarity index 100% rename from Dockerfile.php8 rename to build/php-8.0/Dockerfile diff --git a/build/php-8.0/Makefile b/build/php-8.0/Makefile new file mode 100644 index 0000000..3e607df --- /dev/null +++ b/build/php-8.0/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.0 test-php-8.0 test-suite-php-8.0 + +prepare-php-8.0: ## load dependencies with php 8.0 + docker-compose run -T php-8.0 /usr/bin/composer update + +test-php-8.0: prepare-php-8.0 ## run tests against php 8.0 + docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration phpunit.xml + +test-suite-php-8.0: prepare-php-8.0 ## run suite tests against php 8.0, ex: make test-suite-php-8.0 SUITE="unit" + docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index f0636d4..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '3.5' - -services: - php: - build: . - volumes: - - .:/app - network_mode: host - - php8: - build: - context: . - dockerfile: Dockerfile.php8 - volumes: - - .:/app - network_mode: host \ No newline at end of file diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 1a5512f..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - SMSAPI Coding Standard - - - - - */Standards/*/Tests/*\.(inc|css|js) - - - - - - **/tests/Unit/** - **/tests/Integration/** - - \ No newline at end of file diff --git a/phpunit.dist.xml b/tests-resources/phpunit.dist.xml similarity index 100% rename from phpunit.dist.xml rename to tests-resources/phpunit.dist.xml From 8ca3fa1f67ff1a6a2669146573bd6adadab2f6b8 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 15 Nov 2022 16:40:19 +0100 Subject: [PATCH 24/68] Extracts build assets to separate directory --- .gitignore | 2 +- build/php-7.0/Makefile | 4 ++-- build/php-8.0/Makefile | 4 ++-- tests-resources/phpunit.dist.xml | 38 ++++++++++++++++---------------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 0ba02c9..130e21e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /tests-resources/config/config.yml +/tests-resources/phpunit.xml /vendor /composer.lock -/phpunit.xml .phpunit.result.cache diff --git a/build/php-7.0/Makefile b/build/php-7.0/Makefile index 50000f8..9f16c05 100644 --- a/build/php-7.0/Makefile +++ b/build/php-7.0/Makefile @@ -4,7 +4,7 @@ prepare-php-7.0: ## load dependencies with php 7.0 docker-compose run -T php-7.0 /usr/bin/composer update test-php-7.0: prepare-php-7.0 ## run tests against php 7.0 - docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration phpunit.xml + docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.0: prepare-php-7.0 ## run suite tests against php 7.0, ex: make test-suite-php-7.0 SUITE="unit" - docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.0/Makefile b/build/php-8.0/Makefile index 3e607df..e834ead 100644 --- a/build/php-8.0/Makefile +++ b/build/php-8.0/Makefile @@ -4,7 +4,7 @@ prepare-php-8.0: ## load dependencies with php 8.0 docker-compose run -T php-8.0 /usr/bin/composer update test-php-8.0: prepare-php-8.0 ## run tests against php 8.0 - docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration phpunit.xml + docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.0: prepare-php-8.0 ## run suite tests against php 8.0, ex: make test-suite-php-8.0 SUITE="unit" - docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/tests-resources/phpunit.dist.xml b/tests-resources/phpunit.dist.xml index 4719765..4d4acd5 100644 --- a/tests-resources/phpunit.dist.xml +++ b/tests-resources/phpunit.dist.xml @@ -1,7 +1,7 @@ - tests + ../tests - tests/Unit + ../tests/Unit - tests/Integration + ../tests/Integration - tests/Integration/Feature/Contacts - tests/Unit/Feature/Contacts + ../tests/Integration/Feature/Contacts + ../tests/Unit/Feature/Contacts - tests/Integration/Feature/Hlr + ../tests/Integration/Feature/Hlr - tests/Integration/Feature/Mms + ../tests/Integration/Feature/Mms - tests/Integration/Feature/Ping + ../tests/Integration/Feature/Ping - tests/Integration/Feature/Profile + ../tests/Integration/Feature/Profile - tests/Unit/Feature/Push + ../tests/Unit/Feature/Push - tests/Integration/Feature/Sendernames + ../tests/Integration/Feature/Sendernames - tests/Integration/Feature/ShortUrl + ../tests/Integration/Feature/ShortUrl - tests/Integration/Feature/Sms - tests/Unit/Feature/Sms + ../tests/Integration/Feature/Sms + ../tests/Unit/Feature/Sms - tests/Integration/Feature/Mfa + ../tests/Integration/Feature/Mfa - tests/Integration/Feature/Subusers + ../tests/Integration/Feature/Subusers - tests/Integration/Feature/Vms + ../tests/Integration/Feature/Vms - tests/Integration/Feature/Blacklist + ../tests/Integration/Feature/Blacklist From 2be565fd19f3fc2ed412598e738e7e3c740fe3a8 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 16 Nov 2022 12:01:27 +0100 Subject: [PATCH 25/68] Fixes broken dev dependencies --- build/Makefile | 15 +++++++++++++++ build/docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ build/php-7.0/Dockerfile | 2 +- build/php-7.1/Dockerfile | 17 +++++++++++++++++ build/php-7.1/Makefile | 10 ++++++++++ build/php-7.2/Dockerfile | 17 +++++++++++++++++ build/php-7.2/Makefile | 10 ++++++++++ build/php-7.3/Dockerfile | 17 +++++++++++++++++ build/php-7.3/Makefile | 10 ++++++++++ build/php-7.4/Dockerfile | 17 +++++++++++++++++ build/php-7.4/Makefile | 10 ++++++++++ build/php-8.0/Dockerfile | 2 +- build/php-8.1/Dockerfile | 17 +++++++++++++++++ build/php-8.1/Makefile | 10 ++++++++++ composer.json | 5 +++-- 15 files changed, 190 insertions(+), 4 deletions(-) create mode 100644 build/php-7.1/Dockerfile create mode 100644 build/php-7.1/Makefile create mode 100644 build/php-7.2/Dockerfile create mode 100644 build/php-7.2/Makefile create mode 100644 build/php-7.3/Dockerfile create mode 100644 build/php-7.3/Makefile create mode 100644 build/php-7.4/Dockerfile create mode 100644 build/php-7.4/Makefile create mode 100644 build/php-8.1/Dockerfile create mode 100644 build/php-8.1/Makefile diff --git a/build/Makefile b/build/Makefile index 75050a5..301709d 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,7 +1,12 @@ .PHONY: help build test include $(CURDIR)/php-7.0/Makefile +include $(CURDIR)/php-7.1/Makefile +include $(CURDIR)/php-7.2/Makefile +include $(CURDIR)/php-7.3/Makefile +include $(CURDIR)/php-7.4/Makefile include $(CURDIR)/php-8.0/Makefile +include $(CURDIR)/php-8.1/Makefile help: @grep -hE '^[a-zA-Z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -13,10 +18,20 @@ build: ## build php images test: ## test all against all php images $(MAKE) test-php-7.0 + $(MAKE) test-php-7.1 + $(MAKE) test-php-7.2 + $(MAKE) test-php-7.3 + $(MAKE) test-php-7.4 $(MAKE) test-php-8.0 + $(MAKE) test-php-8.1 test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-7.0 SUITE=unit + $(MAKE) test-suite-php-7.1 SUITE=unit + $(MAKE) test-suite-php-7.2 SUITE=unit + $(MAKE) test-suite-php-7.3 SUITE=unit + $(MAKE) test-suite-php-7.4 SUITE=unit $(MAKE) test-suite-php-8.0 SUITE=unit + $(MAKE) test-suite-php-8.1 SUITE=unit .DEFAULT_GOAL := help diff --git a/build/docker-compose.yml b/build/docker-compose.yml index d65f1c9..4686555 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -9,9 +9,44 @@ services: - ..:/app network_mode: host + php-7.1: + build: + context: php-7.1 + volumes: + - ..:/app + network_mode: host + + php-7.2: + build: + context: php-7.2 + volumes: + - ..:/app + network_mode: host + + php-7.3: + build: + context: php-7.3 + volumes: + - ..:/app + network_mode: host + + php-7.4: + build: + context: php-7.4 + volumes: + - ..:/app + network_mode: host + php-8.0: build: context: php-8.0 volumes: - ..:/app + network_mode: host + + php-8.1: + build: + context: php-8.1 + volumes: + - ..:/app network_mode: host \ No newline at end of file diff --git a/build/php-7.0/Dockerfile b/build/php-7.0/Dockerfile index 2962bf0..4ca628f 100644 --- a/build/php-7.0/Dockerfile +++ b/build/php-7.0/Dockerfile @@ -8,7 +8,7 @@ RUN apk update && \ g++ \ make -RUN pecl install xdebug-2.7.2 && \ +RUN pecl install xdebug-2.8.1 && \ pecl clear-cache && \ docker-php-ext-enable xdebug diff --git a/build/php-7.1/Dockerfile b/build/php-7.1/Dockerfile new file mode 100644 index 0000000..690c835 --- /dev/null +++ b/build/php-7.1/Dockerfile @@ -0,0 +1,17 @@ +FROM composer:2.2 as composer +FROM php:7.1-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make + +RUN pecl install xdebug-2.9.8 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-7.1/Makefile b/build/php-7.1/Makefile new file mode 100644 index 0000000..b3a33d3 --- /dev/null +++ b/build/php-7.1/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-7.1 test-php-7.1 test-suite-php-7.1 + +prepare-php-7.1: ## load dependencies with php 7.1 + docker-compose run -T php-7.1 /usr/bin/composer update + +test-php-7.1: prepare-php-7.1 ## run tests against php 7.1 + docker-compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-7.1: prepare-php-7.1 ## run suite tests against php 7.1, ex: make test-suite-php-7.1 SUITE="unit" + docker-compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.2/Dockerfile b/build/php-7.2/Dockerfile new file mode 100644 index 0000000..0876175 --- /dev/null +++ b/build/php-7.2/Dockerfile @@ -0,0 +1,17 @@ +FROM composer:2.2 as composer +FROM php:7.2-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make + +RUN pecl install xdebug-2.9.8 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-7.2/Makefile b/build/php-7.2/Makefile new file mode 100644 index 0000000..46d4374 --- /dev/null +++ b/build/php-7.2/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-7.2 test-php-7.2 test-suite-php-7.2 + +prepare-php-7.2: ## load dependencies with php 7.2 + docker-compose run -T php-7.2 /usr/bin/composer update + +test-php-7.2: prepare-php-7.2 ## run tests against php 7.2 + docker-compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-7.2: prepare-php-7.2 ## run suite tests against php 7.2, ex: make test-suite-php-7.2 SUITE="unit" + docker-compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.3/Dockerfile b/build/php-7.3/Dockerfile new file mode 100644 index 0000000..e2dee2e --- /dev/null +++ b/build/php-7.3/Dockerfile @@ -0,0 +1,17 @@ +FROM composer:2.2 as composer +FROM php:7.3-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make + +RUN pecl install xdebug-2.9.8 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-7.3/Makefile b/build/php-7.3/Makefile new file mode 100644 index 0000000..d866e53 --- /dev/null +++ b/build/php-7.3/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-7.3 test-php-7.3 test-suite-php-7.3 + +prepare-php-7.3: ## load dependencies with php 7.3 + docker-compose run -T php-7.3 /usr/bin/composer update + +test-php-7.3: prepare-php-7.3 ## run tests against php 7.3 + docker-compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-7.3: prepare-php-7.3 ## run suite tests against php 7.3, ex: make test-suite-php-7.3 SUITE="unit" + docker-compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.4/Dockerfile b/build/php-7.4/Dockerfile new file mode 100644 index 0000000..24a17d3 --- /dev/null +++ b/build/php-7.4/Dockerfile @@ -0,0 +1,17 @@ +FROM composer:2.2 as composer +FROM php:7.4-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make + +RUN pecl install xdebug-2.9.8 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-7.4/Makefile b/build/php-7.4/Makefile new file mode 100644 index 0000000..412c121 --- /dev/null +++ b/build/php-7.4/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-7.4 test-php-7.4 test-suite-php-7.4 + +prepare-php-7.4: ## load dependencies with php 7.4 + docker-compose run -T php-7.4 /usr/bin/composer update + +test-php-7.4: prepare-php-7.4 ## run tests against php 7.4 + docker-compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-7.4: prepare-php-7.4 ## run suite tests against php 7.4, ex: make test-suite-php-7.4 SUITE="unit" + docker-compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.0/Dockerfile b/build/php-8.0/Dockerfile index c2916f9..b75744e 100644 --- a/build/php-8.0/Dockerfile +++ b/build/php-8.0/Dockerfile @@ -8,7 +8,7 @@ RUN apk update && \ g++ \ make -RUN pecl install xdebug-3.0.2 && \ +RUN pecl install xdebug-3.1.6 && \ pecl clear-cache && \ docker-php-ext-enable xdebug diff --git a/build/php-8.1/Dockerfile b/build/php-8.1/Dockerfile new file mode 100644 index 0000000..a68b5e2 --- /dev/null +++ b/build/php-8.1/Dockerfile @@ -0,0 +1,17 @@ +FROM composer:latest as composer +FROM php:8.1-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make + +RUN pecl install xdebug-3.1.6 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-8.1/Makefile b/build/php-8.1/Makefile new file mode 100644 index 0000000..517275d --- /dev/null +++ b/build/php-8.1/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.1 test-php-8.1 test-suite-php-8.1 + +prepare-php-8.1: ## load dependencies with php 8.1 + docker-compose run -T php-8.1 /usr/bin/composer update + +test-php-8.1: prepare-php-8.1 ## run tests against php 8.1 + docker-compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-8.1: prepare-php-8.1 ## run suite tests against php 8.1, ex: make test-suite-php-8.1 SUITE="unit" + docker-compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/composer.json b/composer.json index f477dee..d636efe 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": "^7 || ^8.0", + "php": "^7 || ~8.0 || ~8.1", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", "psr/http-message": "^1", @@ -25,7 +25,8 @@ }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6 || ^8", + "phpunit/phpunit": "^6 || ~8.5", + "phpspec/prophecy": "^1.7", "symfony/yaml": "^3", "doctrine/instantiator": "1.0.5 || ^1.4.0", "phpdocumentor/reflection-docblock": "^4.3 || ^5.2.0", From 91cd562487b35d51bda497755a4d152a811d4e11 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 16 Nov 2022 13:58:13 +0100 Subject: [PATCH 26/68] Fixes dynamic property deprecations --- .github/workflows/tests.yml | 35 +++++++++++++++++-- CHANGELOG.md | 2 ++ build/Makefile | 3 ++ build/docker-compose.yml | 7 ++++ build/php-8.2/Dockerfile | 18 ++++++++++ build/php-8.2/Makefile | 10 ++++++ composer.json | 2 +- .../Bag/CreateBlacklistedPhoneNumberBag.php | 1 + .../Bag/DeleteBlacklistedPhoneNumberBag.php | 1 + .../Bag/FindBlacklistedPhoneNumbersBag.php | 1 + src/Feature/Contacts/Bag/CreateContactBag.php | 1 + src/Feature/Contacts/Bag/DeleteContactBag.php | 1 + src/Feature/Contacts/Bag/FindContactBag.php | 1 + src/Feature/Contacts/Bag/FindContactsBag.php | 1 + src/Feature/Contacts/Bag/UpdateContactBag.php | 1 + .../Fields/Bag/CreateContactFieldBag.php | 1 + .../Fields/Bag/DeleteContactFieldBag.php | 1 + .../Fields/Bag/FindContactFieldOptionsBag.php | 1 + .../Fields/Bag/UpdateContactFieldBag.php | 1 + .../Groups/Bag/AssignContactToGroupBag.php | 1 + .../Contacts/Groups/Bag/CreateGroupBag.php | 1 + .../Contacts/Groups/Bag/DeleteGroupBag.php | 1 + .../Groups/Bag/FindContactGroupBag.php | 1 + .../Groups/Bag/FindContactGroupsBag.php | 1 + .../Contacts/Groups/Bag/FindGroupBag.php | 1 + .../Groups/Bag/UnpinContactFromGroupBag.php | 1 + .../Contacts/Groups/Bag/UpdateGroupBag.php | 1 + .../Bag/AddContactToGroupByQueryBag.php | 1 + .../Members/Bag/FindContactInGroupBag.php | 1 + .../Bag/MoveContactToGroupByQueryBag.php | 1 + .../Members/Bag/PinContactToGroupBag.php | 1 + .../Members/Bag/UnpinContactFromGroupBag.php | 1 + .../Bag/UnpinContactFromGroupByQueryBag.php | 1 + .../Bag/CreateGroupPermissionBag.php | 1 + .../Bag/DeleteGroupPermissionBag.php | 1 + .../Bag/FindGroupPermissionBag.php | 1 + .../Bag/FindGroupPermissionsBag.php | 1 + .../Bag/UpdateGroupPermissionBag.php | 1 + src/Feature/Hlr/Bag/SendHlrBag.php | 1 + src/Feature/Mfa/Bag/CreateMfaBag.php | 1 + src/Feature/Mfa/Bag/VerificationMfaBag.php | 1 + src/Feature/Mms/Bag/SendMmsBag.php | 1 + .../ShortUrl/Bag/CreateShortUrlLinkBag.php | 3 +- .../Sms/Bag/DeleteScheduledSmssBag.php | 4 +++ src/Feature/Sms/Bag/ScheduleSmsBag.php | 1 + src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php | 1 + src/Feature/Sms/Bag/ScheduleSmssBag.php | 1 + src/Feature/Sms/Bag/SendSmsBag.php | 1 + src/Feature/Sms/Bag/SendSmsToGroupBag.php | 1 + src/Feature/Sms/Bag/SendSmssBag.php | 1 + .../Sendernames/Bag/CreateSendernameBag.php | 1 + .../Sendernames/Bag/DeleteSendernameBag.php | 1 + .../Sms/Sendernames/Bag/FindSendernameBag.php | 1 + .../Bag/MakeSendernameDefaultBag.php | 1 + src/Feature/Subusers/Bag/CreateSubuserBag.php | 1 + src/Feature/Subusers/Bag/DeleteSubuserBag.php | 1 + src/Feature/Subusers/Bag/UpdateSubuserBag.php | 1 + src/Feature/Vms/Bag/SendVmsBag.php | 1 + 58 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 build/php-8.2/Dockerfile create mode 100644 build/php-8.2/Makefile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6d4fa90..a00ac7e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: jobs: tests: - name: PHP ${{ matrix.php }} / ${{ matrix.dependency-version }} + name: PHP ${{ matrix.php }} runs-on: ubuntu-latest strategy: matrix: @@ -37,10 +37,41 @@ jobs: uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }} + key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} - name: Install dependencies run: composer update --prefer-dist --no-interaction - name: Running unit tests run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit + + tests-rc: + name: PHP ${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + matrix: + php: + - 8.2 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction --ignore-platform-req=PHP + + - name: Running unit tests + run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 67f292b..94cbde5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- dynamic property deprecations ## [3.0.6] - 2022-03-28 ### Fixed diff --git a/build/Makefile b/build/Makefile index 301709d..5f5b75e 100644 --- a/build/Makefile +++ b/build/Makefile @@ -7,6 +7,7 @@ include $(CURDIR)/php-7.3/Makefile include $(CURDIR)/php-7.4/Makefile include $(CURDIR)/php-8.0/Makefile include $(CURDIR)/php-8.1/Makefile +include $(CURDIR)/php-8.2/Makefile help: @grep -hE '^[a-zA-Z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -24,6 +25,7 @@ test: ## test all against all php images $(MAKE) test-php-7.4 $(MAKE) test-php-8.0 $(MAKE) test-php-8.1 + $(MAKE) test-php-8.2 test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-7.0 SUITE=unit @@ -33,5 +35,6 @@ test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-7.4 SUITE=unit $(MAKE) test-suite-php-8.0 SUITE=unit $(MAKE) test-suite-php-8.1 SUITE=unit + $(MAKE) test-suite-php-8.2 SUITE=unit .DEFAULT_GOAL := help diff --git a/build/docker-compose.yml b/build/docker-compose.yml index 4686555..400c527 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -49,4 +49,11 @@ services: context: php-8.1 volumes: - ..:/app + network_mode: host + + php-8.2: + build: + context: php-8.2 + volumes: + - ..:/app network_mode: host \ No newline at end of file diff --git a/build/php-8.2/Dockerfile b/build/php-8.2/Dockerfile new file mode 100644 index 0000000..7ddc48f --- /dev/null +++ b/build/php-8.2/Dockerfile @@ -0,0 +1,18 @@ +FROM composer:latest as composer +FROM php:8.2-rc-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make \ + linux-headers + +RUN pecl install xdebug-3.2.0RC2 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-8.2/Makefile b/build/php-8.2/Makefile new file mode 100644 index 0000000..7d07aca --- /dev/null +++ b/build/php-8.2/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.2 test-php-8.2 test-suite-php-8.2 + +prepare-php-8.2: ## load dependencies with php 8.2 + docker-compose run -T php-8.2 /usr/bin/composer update --ignore-platform-req=PHP + +test-php-8.2: prepare-php-8.2 ## run tests against php 8.2 + docker-compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-8.2: prepare-php-8.2 ## run suite tests against php 8.2, ex: make test-suite-php-8.2 SUITE="unit" + docker-compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/composer.json b/composer.json index d636efe..7b4119b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": "^7 || ~8.0 || ~8.1", + "php": "^7 || ~8.0 || ~8.1 || ~8.2", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", "psr/http-message": "^1", diff --git a/src/Feature/Blacklist/Bag/CreateBlacklistedPhoneNumberBag.php b/src/Feature/Blacklist/Bag/CreateBlacklistedPhoneNumberBag.php index f51be56..571ef95 100644 --- a/src/Feature/Blacklist/Bag/CreateBlacklistedPhoneNumberBag.php +++ b/src/Feature/Blacklist/Bag/CreateBlacklistedPhoneNumberBag.php @@ -10,6 +10,7 @@ * @api * @property DateTimeInterface $expireAt */ +#[\AllowDynamicProperties] class CreateBlacklistedPhoneNumberBag { /** @var string */ diff --git a/src/Feature/Blacklist/Bag/DeleteBlacklistedPhoneNumberBag.php b/src/Feature/Blacklist/Bag/DeleteBlacklistedPhoneNumberBag.php index cdeb83b..e7ebf9e 100644 --- a/src/Feature/Blacklist/Bag/DeleteBlacklistedPhoneNumberBag.php +++ b/src/Feature/Blacklist/Bag/DeleteBlacklistedPhoneNumberBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteBlacklistedPhoneNumberBag { /** @var string */ diff --git a/src/Feature/Blacklist/Bag/FindBlacklistedPhoneNumbersBag.php b/src/Feature/Blacklist/Bag/FindBlacklistedPhoneNumbersBag.php index 635f79f..4e3fbee 100644 --- a/src/Feature/Blacklist/Bag/FindBlacklistedPhoneNumbersBag.php +++ b/src/Feature/Blacklist/Bag/FindBlacklistedPhoneNumbersBag.php @@ -10,6 +10,7 @@ * @api * @property string $q */ +#[\AllowDynamicProperties] class FindBlacklistedPhoneNumbersBag { use PaginationBag; diff --git a/src/Feature/Contacts/Bag/CreateContactBag.php b/src/Feature/Contacts/Bag/CreateContactBag.php index 1c67efb..54ffd65 100644 --- a/src/Feature/Contacts/Bag/CreateContactBag.php +++ b/src/Feature/Contacts/Bag/CreateContactBag.php @@ -16,6 +16,7 @@ * @property string $city * @property string $source */ +#[\AllowDynamicProperties] class CreateContactBag { /** diff --git a/src/Feature/Contacts/Bag/DeleteContactBag.php b/src/Feature/Contacts/Bag/DeleteContactBag.php index dacee6d..a3363c0 100644 --- a/src/Feature/Contacts/Bag/DeleteContactBag.php +++ b/src/Feature/Contacts/Bag/DeleteContactBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteContactBag { diff --git a/src/Feature/Contacts/Bag/FindContactBag.php b/src/Feature/Contacts/Bag/FindContactBag.php index 6198a1d..157a6bb 100644 --- a/src/Feature/Contacts/Bag/FindContactBag.php +++ b/src/Feature/Contacts/Bag/FindContactBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindContactBag { diff --git a/src/Feature/Contacts/Bag/FindContactsBag.php b/src/Feature/Contacts/Bag/FindContactsBag.php index ea83eb2..e75445b 100644 --- a/src/Feature/Contacts/Bag/FindContactsBag.php +++ b/src/Feature/Contacts/Bag/FindContactsBag.php @@ -18,6 +18,7 @@ * @property string $gender * @property string $birthdayDate */ +#[\AllowDynamicProperties] class FindContactsBag { use PaginationBag; diff --git a/src/Feature/Contacts/Bag/UpdateContactBag.php b/src/Feature/Contacts/Bag/UpdateContactBag.php index bfeed43..4458055 100644 --- a/src/Feature/Contacts/Bag/UpdateContactBag.php +++ b/src/Feature/Contacts/Bag/UpdateContactBag.php @@ -16,6 +16,7 @@ * @property string $city * @property string $source */ +#[\AllowDynamicProperties] class UpdateContactBag { diff --git a/src/Feature/Contacts/Fields/Bag/CreateContactFieldBag.php b/src/Feature/Contacts/Fields/Bag/CreateContactFieldBag.php index 1a45b1c..2269dcc 100644 --- a/src/Feature/Contacts/Fields/Bag/CreateContactFieldBag.php +++ b/src/Feature/Contacts/Fields/Bag/CreateContactFieldBag.php @@ -8,6 +8,7 @@ * @api * @property string $type */ +#[\AllowDynamicProperties] class CreateContactFieldBag { diff --git a/src/Feature/Contacts/Fields/Bag/DeleteContactFieldBag.php b/src/Feature/Contacts/Fields/Bag/DeleteContactFieldBag.php index ecdaabb..cbbb706 100644 --- a/src/Feature/Contacts/Fields/Bag/DeleteContactFieldBag.php +++ b/src/Feature/Contacts/Fields/Bag/DeleteContactFieldBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteContactFieldBag { diff --git a/src/Feature/Contacts/Fields/Bag/FindContactFieldOptionsBag.php b/src/Feature/Contacts/Fields/Bag/FindContactFieldOptionsBag.php index e48acc9..adf4d6d 100644 --- a/src/Feature/Contacts/Fields/Bag/FindContactFieldOptionsBag.php +++ b/src/Feature/Contacts/Fields/Bag/FindContactFieldOptionsBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindContactFieldOptionsBag { diff --git a/src/Feature/Contacts/Fields/Bag/UpdateContactFieldBag.php b/src/Feature/Contacts/Fields/Bag/UpdateContactFieldBag.php index 1dd2024..0e5cdbd 100644 --- a/src/Feature/Contacts/Fields/Bag/UpdateContactFieldBag.php +++ b/src/Feature/Contacts/Fields/Bag/UpdateContactFieldBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class UpdateContactFieldBag { diff --git a/src/Feature/Contacts/Groups/Bag/AssignContactToGroupBag.php b/src/Feature/Contacts/Groups/Bag/AssignContactToGroupBag.php index f4124ad..b51723e 100644 --- a/src/Feature/Contacts/Groups/Bag/AssignContactToGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/AssignContactToGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class AssignContactToGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/CreateGroupBag.php b/src/Feature/Contacts/Groups/Bag/CreateGroupBag.php index 4770a7c..80e934a 100644 --- a/src/Feature/Contacts/Groups/Bag/CreateGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/CreateGroupBag.php @@ -10,6 +10,7 @@ * @property string $idx * @property integer $contactExpireAfter */ +#[\AllowDynamicProperties] class CreateGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/DeleteGroupBag.php b/src/Feature/Contacts/Groups/Bag/DeleteGroupBag.php index d6f1bdf..cf7da05 100644 --- a/src/Feature/Contacts/Groups/Bag/DeleteGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/DeleteGroupBag.php @@ -8,6 +8,7 @@ * @api * @property bool $deleteContacts */ +#[\AllowDynamicProperties] class DeleteGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/FindContactGroupBag.php b/src/Feature/Contacts/Groups/Bag/FindContactGroupBag.php index 3c4c8e6..2ecfb43 100644 --- a/src/Feature/Contacts/Groups/Bag/FindContactGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/FindContactGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindContactGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/FindContactGroupsBag.php b/src/Feature/Contacts/Groups/Bag/FindContactGroupsBag.php index 9ff20f4..053a7bc 100644 --- a/src/Feature/Contacts/Groups/Bag/FindContactGroupsBag.php +++ b/src/Feature/Contacts/Groups/Bag/FindContactGroupsBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindContactGroupsBag { diff --git a/src/Feature/Contacts/Groups/Bag/FindGroupBag.php b/src/Feature/Contacts/Groups/Bag/FindGroupBag.php index 3b17dd4..b169b8a 100644 --- a/src/Feature/Contacts/Groups/Bag/FindGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/FindGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/UnpinContactFromGroupBag.php b/src/Feature/Contacts/Groups/Bag/UnpinContactFromGroupBag.php index 550b81d..3b9000d 100644 --- a/src/Feature/Contacts/Groups/Bag/UnpinContactFromGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/UnpinContactFromGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class UnpinContactFromGroupBag { diff --git a/src/Feature/Contacts/Groups/Bag/UpdateGroupBag.php b/src/Feature/Contacts/Groups/Bag/UpdateGroupBag.php index ca9a3e4..2eb918f 100644 --- a/src/Feature/Contacts/Groups/Bag/UpdateGroupBag.php +++ b/src/Feature/Contacts/Groups/Bag/UpdateGroupBag.php @@ -10,6 +10,7 @@ * @property string $idx * @property integer $contactExpireAfter */ +#[\AllowDynamicProperties] class UpdateGroupBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/AddContactToGroupByQueryBag.php b/src/Feature/Contacts/Groups/Members/Bag/AddContactToGroupByQueryBag.php index 5d63613..a8ee959 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/AddContactToGroupByQueryBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/AddContactToGroupByQueryBag.php @@ -15,6 +15,7 @@ * @property string $gender * @property string $birthdayDate */ +#[\AllowDynamicProperties] class AddContactToGroupByQueryBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/FindContactInGroupBag.php b/src/Feature/Contacts/Groups/Members/Bag/FindContactInGroupBag.php index ffa7b02..9238eaa 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/FindContactInGroupBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/FindContactInGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindContactInGroupBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/MoveContactToGroupByQueryBag.php b/src/Feature/Contacts/Groups/Members/Bag/MoveContactToGroupByQueryBag.php index c7591b5..2d88a19 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/MoveContactToGroupByQueryBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/MoveContactToGroupByQueryBag.php @@ -15,6 +15,7 @@ * @property string $gender * @property string $birthdayDate */ +#[\AllowDynamicProperties] class MoveContactToGroupByQueryBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/PinContactToGroupBag.php b/src/Feature/Contacts/Groups/Members/Bag/PinContactToGroupBag.php index be2f10a..9fe9cbb 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/PinContactToGroupBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/PinContactToGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class PinContactToGroupBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupBag.php b/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupBag.php index 992a168..50cde48 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class UnpinContactFromGroupBag { diff --git a/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupByQueryBag.php b/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupByQueryBag.php index a7a8cd3..e36d5c8 100644 --- a/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupByQueryBag.php +++ b/src/Feature/Contacts/Groups/Members/Bag/UnpinContactFromGroupByQueryBag.php @@ -15,6 +15,7 @@ * @property string $gender * @property string $birthdayDate */ +#[\AllowDynamicProperties] class UnpinContactFromGroupByQueryBag { diff --git a/src/Feature/Contacts/Groups/Permissions/Bag/CreateGroupPermissionBag.php b/src/Feature/Contacts/Groups/Permissions/Bag/CreateGroupPermissionBag.php index 6305d3e..e48404a 100644 --- a/src/Feature/Contacts/Groups/Permissions/Bag/CreateGroupPermissionBag.php +++ b/src/Feature/Contacts/Groups/Permissions/Bag/CreateGroupPermissionBag.php @@ -10,6 +10,7 @@ * @property string $write * @property string $send */ +#[\AllowDynamicProperties] class CreateGroupPermissionBag { diff --git a/src/Feature/Contacts/Groups/Permissions/Bag/DeleteGroupPermissionBag.php b/src/Feature/Contacts/Groups/Permissions/Bag/DeleteGroupPermissionBag.php index f6ba1f2..591cad1 100644 --- a/src/Feature/Contacts/Groups/Permissions/Bag/DeleteGroupPermissionBag.php +++ b/src/Feature/Contacts/Groups/Permissions/Bag/DeleteGroupPermissionBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteGroupPermissionBag { diff --git a/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionBag.php b/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionBag.php index 4c285e0..150efff 100644 --- a/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionBag.php +++ b/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindGroupPermissionBag { diff --git a/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionsBag.php b/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionsBag.php index e7d2327..384d47e 100644 --- a/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionsBag.php +++ b/src/Feature/Contacts/Groups/Permissions/Bag/FindGroupPermissionsBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindGroupPermissionsBag { diff --git a/src/Feature/Contacts/Groups/Permissions/Bag/UpdateGroupPermissionBag.php b/src/Feature/Contacts/Groups/Permissions/Bag/UpdateGroupPermissionBag.php index 4a807e4..54fd14e 100644 --- a/src/Feature/Contacts/Groups/Permissions/Bag/UpdateGroupPermissionBag.php +++ b/src/Feature/Contacts/Groups/Permissions/Bag/UpdateGroupPermissionBag.php @@ -10,6 +10,7 @@ * @property string $write * @property string $send */ +#[\AllowDynamicProperties] class UpdateGroupPermissionBag { diff --git a/src/Feature/Hlr/Bag/SendHlrBag.php b/src/Feature/Hlr/Bag/SendHlrBag.php index fa7428a..991fc60 100644 --- a/src/Feature/Hlr/Bag/SendHlrBag.php +++ b/src/Feature/Hlr/Bag/SendHlrBag.php @@ -8,6 +8,7 @@ * @api * @property string $idx */ +#[\AllowDynamicProperties] class SendHlrBag { diff --git a/src/Feature/Mfa/Bag/CreateMfaBag.php b/src/Feature/Mfa/Bag/CreateMfaBag.php index 05036be..bafdac6 100644 --- a/src/Feature/Mfa/Bag/CreateMfaBag.php +++ b/src/Feature/Mfa/Bag/CreateMfaBag.php @@ -10,6 +10,7 @@ * @property string $content * @property bool $fast */ +#[\AllowDynamicProperties] class CreateMfaBag { /** diff --git a/src/Feature/Mfa/Bag/VerificationMfaBag.php b/src/Feature/Mfa/Bag/VerificationMfaBag.php index f1c8a7c..ba371e4 100644 --- a/src/Feature/Mfa/Bag/VerificationMfaBag.php +++ b/src/Feature/Mfa/Bag/VerificationMfaBag.php @@ -7,6 +7,7 @@ /** * @api */ +#[\AllowDynamicProperties] class VerificationMfaBag { /** diff --git a/src/Feature/Mms/Bag/SendMmsBag.php b/src/Feature/Mms/Bag/SendMmsBag.php index e3ce33a..6db03e1 100644 --- a/src/Feature/Mms/Bag/SendMmsBag.php +++ b/src/Feature/Mms/Bag/SendMmsBag.php @@ -7,6 +7,7 @@ * @api * @property bool $test */ +#[\AllowDynamicProperties] class SendMmsBag { diff --git a/src/Feature/ShortUrl/Bag/CreateShortUrlLinkBag.php b/src/Feature/ShortUrl/Bag/CreateShortUrlLinkBag.php index 7452f19..05b5e94 100644 --- a/src/Feature/ShortUrl/Bag/CreateShortUrlLinkBag.php +++ b/src/Feature/ShortUrl/Bag/CreateShortUrlLinkBag.php @@ -14,12 +14,13 @@ * @property DateTimeInterface $expire * @property string $description */ +#[\AllowDynamicProperties] class CreateShortUrlLinkBag { public static function withUrl(string $url): self { - $bag = new self(); + $bag = new CreateShortUrlLinkBag(); $bag->url = $url; return $bag; } diff --git a/src/Feature/Sms/Bag/DeleteScheduledSmssBag.php b/src/Feature/Sms/Bag/DeleteScheduledSmssBag.php index 748a5e6..51f6a09 100644 --- a/src/Feature/Sms/Bag/DeleteScheduledSmssBag.php +++ b/src/Feature/Sms/Bag/DeleteScheduledSmssBag.php @@ -4,6 +4,10 @@ namespace Smsapi\Client\Feature\Sms\Bag; +/** + * @api + */ +#[\AllowDynamicProperties] class DeleteScheduledSmssBag { /** @var array */ diff --git a/src/Feature/Sms/Bag/ScheduleSmsBag.php b/src/Feature/Sms/Bag/ScheduleSmsBag.php index dc328e9..443bbb5 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsBag.php @@ -25,6 +25,7 @@ * @property string $param3 * @property string $param4 */ +#[\AllowDynamicProperties] class ScheduleSmsBag { /** @var string */ diff --git a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php index 0b39fa5..28e138d 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php @@ -21,6 +21,7 @@ * @property string $notifyUrl * @property bool $test */ +#[\AllowDynamicProperties] class ScheduleSmsToGroupBag { diff --git a/src/Feature/Sms/Bag/ScheduleSmssBag.php b/src/Feature/Sms/Bag/ScheduleSmssBag.php index 3e5fd10..b6fda24 100644 --- a/src/Feature/Sms/Bag/ScheduleSmssBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmssBag.php @@ -26,6 +26,7 @@ * @property array $param3 * @property array $param4 */ +#[\AllowDynamicProperties] class ScheduleSmssBag { /** @var array */ diff --git a/src/Feature/Sms/Bag/SendSmsBag.php b/src/Feature/Sms/Bag/SendSmsBag.php index 181a00f..23b0400 100644 --- a/src/Feature/Sms/Bag/SendSmsBag.php +++ b/src/Feature/Sms/Bag/SendSmsBag.php @@ -25,6 +25,7 @@ * @property string $param3 * @property string $param4 */ +#[\AllowDynamicProperties] class SendSmsBag { /** @var string */ diff --git a/src/Feature/Sms/Bag/SendSmsToGroupBag.php b/src/Feature/Sms/Bag/SendSmsToGroupBag.php index 52adfdf..e462bbe 100644 --- a/src/Feature/Sms/Bag/SendSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/SendSmsToGroupBag.php @@ -20,6 +20,7 @@ * @property string $notifyUrl * @property bool $test */ +#[\AllowDynamicProperties] class SendSmsToGroupBag { /** @var string */ diff --git a/src/Feature/Sms/Bag/SendSmssBag.php b/src/Feature/Sms/Bag/SendSmssBag.php index fddbf5b..53dc09b 100644 --- a/src/Feature/Sms/Bag/SendSmssBag.php +++ b/src/Feature/Sms/Bag/SendSmssBag.php @@ -26,6 +26,7 @@ * @property array $param3 * @property array $param4 */ +#[\AllowDynamicProperties] class SendSmssBag { /** @var array */ diff --git a/src/Feature/Sms/Sendernames/Bag/CreateSendernameBag.php b/src/Feature/Sms/Sendernames/Bag/CreateSendernameBag.php index 81d6f10..09d40c1 100644 --- a/src/Feature/Sms/Sendernames/Bag/CreateSendernameBag.php +++ b/src/Feature/Sms/Sendernames/Bag/CreateSendernameBag.php @@ -6,6 +6,7 @@ /** * @api */ +#[\AllowDynamicProperties] class CreateSendernameBag { public $sender; diff --git a/src/Feature/Sms/Sendernames/Bag/DeleteSendernameBag.php b/src/Feature/Sms/Sendernames/Bag/DeleteSendernameBag.php index 9f54dde..8e34293 100644 --- a/src/Feature/Sms/Sendernames/Bag/DeleteSendernameBag.php +++ b/src/Feature/Sms/Sendernames/Bag/DeleteSendernameBag.php @@ -6,6 +6,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteSendernameBag { public $sender; diff --git a/src/Feature/Sms/Sendernames/Bag/FindSendernameBag.php b/src/Feature/Sms/Sendernames/Bag/FindSendernameBag.php index cf4e58e..60abde0 100644 --- a/src/Feature/Sms/Sendernames/Bag/FindSendernameBag.php +++ b/src/Feature/Sms/Sendernames/Bag/FindSendernameBag.php @@ -6,6 +6,7 @@ /** * @api */ +#[\AllowDynamicProperties] class FindSendernameBag { public $sender; diff --git a/src/Feature/Sms/Sendernames/Bag/MakeSendernameDefaultBag.php b/src/Feature/Sms/Sendernames/Bag/MakeSendernameDefaultBag.php index 28539af..991e2d0 100644 --- a/src/Feature/Sms/Sendernames/Bag/MakeSendernameDefaultBag.php +++ b/src/Feature/Sms/Sendernames/Bag/MakeSendernameDefaultBag.php @@ -6,6 +6,7 @@ /** * @api */ +#[\AllowDynamicProperties] class MakeSendernameDefaultBag { public $sender; diff --git a/src/Feature/Subusers/Bag/CreateSubuserBag.php b/src/Feature/Subusers/Bag/CreateSubuserBag.php index 2ea4249..a45cb3c 100644 --- a/src/Feature/Subusers/Bag/CreateSubuserBag.php +++ b/src/Feature/Subusers/Bag/CreateSubuserBag.php @@ -8,6 +8,7 @@ * @property bool $active * @property string $description */ +#[\AllowDynamicProperties] class CreateSubuserBag { /** @var string */ diff --git a/src/Feature/Subusers/Bag/DeleteSubuserBag.php b/src/Feature/Subusers/Bag/DeleteSubuserBag.php index 65edc86..b5c741c 100644 --- a/src/Feature/Subusers/Bag/DeleteSubuserBag.php +++ b/src/Feature/Subusers/Bag/DeleteSubuserBag.php @@ -6,6 +6,7 @@ /** * @api */ +#[\AllowDynamicProperties] class DeleteSubuserBag { public $id; diff --git a/src/Feature/Subusers/Bag/UpdateSubuserBag.php b/src/Feature/Subusers/Bag/UpdateSubuserBag.php index f7eea08..fff8f26 100644 --- a/src/Feature/Subusers/Bag/UpdateSubuserBag.php +++ b/src/Feature/Subusers/Bag/UpdateSubuserBag.php @@ -11,6 +11,7 @@ * @property bool $active * @property string $description */ +#[\AllowDynamicProperties] class UpdateSubuserBag { /** @var string */ diff --git a/src/Feature/Vms/Bag/SendVmsBag.php b/src/Feature/Vms/Bag/SendVmsBag.php index a194a28..ef88cef 100644 --- a/src/Feature/Vms/Bag/SendVmsBag.php +++ b/src/Feature/Vms/Bag/SendVmsBag.php @@ -13,6 +13,7 @@ * @property bool $checkIdx * @property bool $test */ +#[\AllowDynamicProperties] class SendVmsBag { From 2a77cfac2adc3b52fe8764a30219d0e67dc9a2c1 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 21 Nov 2022 16:55:18 +0100 Subject: [PATCH 27/68] Releases version 3.0.7 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94cbde5..1c8226f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.7] - 2022-11-21 ### Fixed - dynamic property deprecations diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..f90669e 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.7'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 97bf28202df9be8626cfc5e1d709dc143b69a8c9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 27 Mar 2023 10:27:19 +0200 Subject: [PATCH 28/68] Adds PHP 8.2 to tests platform matrix --- .github/workflows/tests.yml | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a00ac7e..aae4263 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,6 +21,7 @@ jobs: - 7.4 - 8.0 - 8.1 + - 8.2 steps: - name: Checkout uses: actions/checkout@v2 @@ -44,34 +45,3 @@ jobs: - name: Running unit tests run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit - - tests-rc: - name: PHP ${{ matrix.php }} - runs-on: ubuntu-latest - strategy: - matrix: - php: - - 8.2 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} - - - name: Install dependencies - run: composer update --prefer-dist --no-interaction --ignore-platform-req=PHP - - - name: Running unit tests - run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit \ No newline at end of file From 9b507d40c5d346783700f818cb39047c15ce73e9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 27 Mar 2023 10:29:39 +0200 Subject: [PATCH 29/68] Adds PHP 8.2 to tests platform matrix --- CHANGELOG.md | 2 ++ src/SmsapiClient.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c8226f..cb4e035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + ## [3.0.7] - 2022-11-21 ### Fixed - dynamic property deprecations diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index f90669e..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.7'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 54e538f71f0023c7e3e74ef0c1a091ccf8bf9fee Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 27 Mar 2023 10:58:44 +0200 Subject: [PATCH 30/68] Updates actions/checkout, NodeJS depreciation issue --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aae4263..6089cdc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: - 8.2 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 From a1a5a934f3244b7e6d7607c5ddf9ed38121ae1e2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 27 Mar 2023 11:01:30 +0200 Subject: [PATCH 31/68] Updates actions/cache, NodeJS depreciation issue --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6089cdc..d8b9a6f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} From 6bf1ba632b20c132ec8fba63deb58f44664e2f4a Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 27 Mar 2023 13:22:52 +0200 Subject: [PATCH 32/68] Updates composer cache GA, set-output depreciation issue --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d8b9a6f..204e766 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: php-version: ${{ matrix.php }} - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies uses: actions/cache@v3 From 96fef9c9bff8b279364548f79953dbf8b44f30dc Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 17 Apr 2023 13:43:56 +0200 Subject: [PATCH 33/68] Fixes build status badge --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f74457..bcd54ec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SMSAPI PHP Client -[![Build Status](https://travis-ci.org/smsapi/smsapi-php-client.svg?branch=master)](https://travis-ci.org/smsapi/smsapi-php-client) +[![Build Status](https://github.com/smsapi/smsapi-php-client/actions/workflows/tests.yml/badge.svg)](https://github.com/smsapi/smsapi-php-client/actions/workflows/tests.yml) [![Packagist - latest version](https://img.shields.io/packagist/v/smsapi/php-client.svg)](https://packagist.org/packages/smsapi/php-client) [![Packagist - downloads](https://img.shields.io/packagist/dt/smsapi/php-client.svg)](https://packagist.org/packages/smsapi/php-client) [![Packagist - license](https://img.shields.io/packagist/l/smsapi/php-client.svg)](https://packagist.org/packages/smsapi/php-client) @@ -276,7 +276,7 @@ Copy `tests-resources/config/config.dist.yml` to `tests-resources/config/config. ### How to run unit tests -Unit tests are included into package build process and run against its current version on every commit (see `.travis.yml`). +Unit tests are included into package build process and run against its current version on every commit (see workflow Tests). You can run those tests locally with ease using provided Docker configuration, simply run: ```shell From fb1973e21e755ce489b451a78f079850c8a4ebf9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 3 Oct 2023 15:35:22 +0200 Subject: [PATCH 34/68] Removes xdebug from PHP 7.0 test image. PHP 7.0 compatible xdebug has been removed from PECL. Cannot find replacement. --- build/php-7.0/Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build/php-7.0/Dockerfile b/build/php-7.0/Dockerfile index 4ca628f..ed516f7 100644 --- a/build/php-7.0/Dockerfile +++ b/build/php-7.0/Dockerfile @@ -8,10 +8,6 @@ RUN apk update && \ g++ \ make -RUN pecl install xdebug-2.8.1 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug - COPY --from=composer /usr/bin/composer /usr/bin/composer WORKDIR /app/ \ No newline at end of file From 267e149ffe5a325c6afae737a762124f9958ea47 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 3 Oct 2023 15:37:44 +0200 Subject: [PATCH 35/68] Upgrades PHP image and related xdebug for PHP 8.2 test image to stable version --- build/php-8.2/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/php-8.2/Dockerfile b/build/php-8.2/Dockerfile index 7ddc48f..9092d51 100644 --- a/build/php-8.2/Dockerfile +++ b/build/php-8.2/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.2-rc-cli-alpine +FROM php:8.2-cli-alpine RUN apk update && \ apk upgrade && \ @@ -9,7 +9,7 @@ RUN apk update && \ make \ linux-headers -RUN pecl install xdebug-3.2.0RC2 && \ +RUN pecl install xdebug-3.2.2 && \ pecl clear-cache && \ docker-php-ext-enable xdebug From 0416ecb87f16ddce1efa55dab0982ce85016f76c Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 4 Oct 2023 10:10:51 +0200 Subject: [PATCH 36/68] Runs test against incoming PHP 8.3 --- .github/workflows/tests.yml | 31 +++++++++++++++++++++++++++++++ build/Makefile | 3 +++ build/docker-compose.yml | 7 +++++++ build/php-8.3/Dockerfile | 18 ++++++++++++++++++ build/php-8.3/Makefile | 10 ++++++++++ 5 files changed, 69 insertions(+) create mode 100644 build/php-8.3/Dockerfile create mode 100644 build/php-8.3/Makefile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 204e766..95f3d3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,3 +45,34 @@ jobs: - name: Running unit tests run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit + + tests-rc: + name: PHP ${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + matrix: + php: + - 8.3 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction --ignore-platform-req=PHP + + - name: Running unit tests + run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit \ No newline at end of file diff --git a/build/Makefile b/build/Makefile index 5f5b75e..21b9005 100644 --- a/build/Makefile +++ b/build/Makefile @@ -8,6 +8,7 @@ include $(CURDIR)/php-7.4/Makefile include $(CURDIR)/php-8.0/Makefile include $(CURDIR)/php-8.1/Makefile include $(CURDIR)/php-8.2/Makefile +include $(CURDIR)/php-8.3/Makefile help: @grep -hE '^[a-zA-Z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -26,6 +27,7 @@ test: ## test all against all php images $(MAKE) test-php-8.0 $(MAKE) test-php-8.1 $(MAKE) test-php-8.2 + $(MAKE) test-php-8.3 test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-7.0 SUITE=unit @@ -36,5 +38,6 @@ test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-8.0 SUITE=unit $(MAKE) test-suite-php-8.1 SUITE=unit $(MAKE) test-suite-php-8.2 SUITE=unit + $(MAKE) test-suite-php-8.3 SUITE=unit .DEFAULT_GOAL := help diff --git a/build/docker-compose.yml b/build/docker-compose.yml index 400c527..af9fe64 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -56,4 +56,11 @@ services: context: php-8.2 volumes: - ..:/app + network_mode: host + + php-8.3: + build: + context: php-8.3 + volumes: + - ..:/app network_mode: host \ No newline at end of file diff --git a/build/php-8.3/Dockerfile b/build/php-8.3/Dockerfile new file mode 100644 index 0000000..7291d69 --- /dev/null +++ b/build/php-8.3/Dockerfile @@ -0,0 +1,18 @@ +FROM composer:latest as composer +FROM php:8.3-rc-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make \ + linux-headers + +RUN pecl install xdebug-3.3.0alpha2 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-8.3/Makefile b/build/php-8.3/Makefile new file mode 100644 index 0000000..edb5c99 --- /dev/null +++ b/build/php-8.3/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.3 test-php-8.3 test-suite-php-8.3 + +prepare-php-8.3: ## load dependencies with php 8.3 + docker-compose run -T php-8.3 /usr/bin/composer update --ignore-platform-req=PHP + +test-php-8.3: prepare-php-8.3 ## run tests against php 8.3 + docker-compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-8.3: prepare-php-8.3 ## run suite tests against php 8.3, ex: make test-suite-php-8.3 SUITE="unit" + docker-compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file From b2b3566184f80b41fed2cf55d995fc0924d2ae55 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 4 Oct 2023 10:20:45 +0200 Subject: [PATCH 37/68] Updates actions/checkout and actions/cache, NodeJS depreciation issue --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 95f3d3e..847ff95 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,7 +55,7 @@ jobs: - 8.3 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -66,7 +66,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composer-cache.outputs.dir }} key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} From cc82b08b2d35b57341cad803b29b840e010536fe Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 4 Oct 2023 10:22:25 +0200 Subject: [PATCH 38/68] Updates composer cache GA, set-output depreciation issue --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 847ff95..c2a5899 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -63,7 +63,7 @@ jobs: php-version: ${{ matrix.php }} - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache Composer dependencies uses: actions/cache@v3 From 573e787815fa68d2c179c5c9f328cb022ea1cef2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 18 Oct 2023 15:42:11 +0200 Subject: [PATCH 39/68] Refactors PHP 8.2 tests --- build/php-8.2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php-8.2/Makefile b/build/php-8.2/Makefile index 7d07aca..c7788aa 100644 --- a/build/php-8.2/Makefile +++ b/build/php-8.2/Makefile @@ -1,7 +1,7 @@ .PHONY: prepare-php-8.2 test-php-8.2 test-suite-php-8.2 prepare-php-8.2: ## load dependencies with php 8.2 - docker-compose run -T php-8.2 /usr/bin/composer update --ignore-platform-req=PHP + docker-compose run -T php-8.2 /usr/bin/composer update test-php-8.2: prepare-php-8.2 ## run tests against php 8.2 docker-compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml From 145c5236d9f2a259e42f75958ad1fab5896dd726 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 18 Oct 2023 15:59:47 +0200 Subject: [PATCH 40/68] Adds psr/http-message v2 support --- CHANGELOG.md | 2 ++ composer.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4e035..2222f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- `psr/http-message` v2 support ## [3.0.7] - 2022-11-21 ### Fixed diff --git a/composer.json b/composer.json index 7b4119b..bbb4849 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "php": "^7 || ~8.0 || ~8.1 || ~8.2", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", - "psr/http-message": "^1", + "psr/http-message": "~1.0 || ~1.1 || ~2.0", "psr/http-client": "^1", "psr/http-factory": "^1" }, @@ -31,7 +31,7 @@ "doctrine/instantiator": "1.0.5 || ^1.4.0", "phpdocumentor/reflection-docblock": "^4.3 || ^5.2.0", "phpdocumentor/type-resolver": "^0.5 || ^1.3.0", - "guzzlehttp/psr7": "^1", + "guzzlehttp/psr7": "^1 || ^2", "ext-curl": "*", "roave/security-advisories": "dev-latest" }, From b01e39e56c0f36eec43f57097fdac69b3defb366 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 18 Oct 2023 16:04:30 +0200 Subject: [PATCH 41/68] Releases version 3.0.8 - resolves #125 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2222f60..46ea11a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.8] ### Added - `psr/http-message` v2 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..f7bed2e 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.8'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 7ddf1b6c86a0c6d2690956f01e3a101a2a81e9f4 Mon Sep 17 00:00:00 2001 From: Adam Lozynski <58483602+lozynskiadam@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:13:52 +0100 Subject: [PATCH 42/68] Handling responses with request timeout status --- src/Infrastructure/ResponseHttpCode.php | 1 + src/Infrastructure/ResponseMapper/RestResponseMapper.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Infrastructure/ResponseHttpCode.php b/src/Infrastructure/ResponseHttpCode.php index 2c201f5..4ef42b5 100644 --- a/src/Infrastructure/ResponseHttpCode.php +++ b/src/Infrastructure/ResponseHttpCode.php @@ -13,5 +13,6 @@ class ResponseHttpCode const CREATED = 201; const ACCEPTED = 202; const NO_CONTENT = 204; + const REQUEST_TIMEOUT = 408; const SERVICE_UNAVAILABLE = 503; } diff --git a/src/Infrastructure/ResponseMapper/RestResponseMapper.php b/src/Infrastructure/ResponseMapper/RestResponseMapper.php index fff15e3..04106a3 100644 --- a/src/Infrastructure/ResponseMapper/RestResponseMapper.php +++ b/src/Infrastructure/ResponseMapper/RestResponseMapper.php @@ -40,6 +40,8 @@ public function map(ResponseInterface $response): stdClass return new stdClass(); } elseif ($statusCode == ResponseHttpCode::SERVICE_UNAVAILABLE) { throw ApiErrorException::withMessageAndStatusCode('Service unavailable', $statusCode); + } elseif ($statusCode == ResponseHttpCode::REQUEST_TIMEOUT) { + throw ApiErrorException::withMessageAndStatusCode('Request timed out', $statusCode); } elseif ($contents) { $object = $this->jsonDecode->decode($contents); From 3970c2b9d27bae03e037691bbb6fd15fda6ba950 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 9 Jan 2024 14:45:51 +0100 Subject: [PATCH 43/68] Releases version 3.0.9 - resolves #126 --- CHANGELOG.md | 6 +++++- src/SmsapiClient.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ea11a..09f118c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [3.0.8] +## [3.0.9] - 2024-01-09 +### Fixed +- expired MFA code verification + +## [3.0.8] - 2023-10-18 ### Added - `psr/http-message` v2 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index f7bed2e..c40e21a 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.8'; + const VERSION = '3.0.9'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 93d11f4384230eada1a264f0f4c4727dd6136287 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 10 Jan 2024 11:16:21 +0100 Subject: [PATCH 44/68] Adds request timeout response test --- CHANGELOG.md | 2 ++ src/SmsapiClient.php | 2 +- .../ResponseMapper/RestResponseMapperTest.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f118c..5b709a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + ## [3.0.9] - 2024-01-09 ### Fixed - expired MFA code verification diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index c40e21a..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.9'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; diff --git a/tests/Unit/Infrastructure/ResponseMapper/RestResponseMapperTest.php b/tests/Unit/Infrastructure/ResponseMapper/RestResponseMapperTest.php index dfbb087..9419e90 100644 --- a/tests/Unit/Infrastructure/ResponseMapper/RestResponseMapperTest.php +++ b/tests/Unit/Infrastructure/ResponseMapper/RestResponseMapperTest.php @@ -92,6 +92,18 @@ public function it_should_throw_exception_on_service_unavailable() $this->restResponseMapper->map($responseWithServiceUnavailable); } + /** + * @test + */ + public function it_should_throw_exception_on_request_timeout() + { + $responseWithServiceUnavailable = new Response(ResponseHttpCode::REQUEST_TIMEOUT); + + $this->expectException(ApiErrorException::class); + $this->expectExceptionMessage("Request timed out"); + $this->restResponseMapper->map($responseWithServiceUnavailable); + } + /** * @test */ From dfadc9682e3df3f4f0a7d23a9a82f0bc45deabff Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 10 Jan 2024 14:01:16 +0100 Subject: [PATCH 45/68] Splits legacy request mapper test --- .../RequestMapper/LegacyRequestMapperTest.php | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php b/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php index 63f910f..da06d89 100644 --- a/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php +++ b/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php @@ -25,10 +25,30 @@ public function init() /** * @test */ - public function it_should_create_post_request_with_parameters() + public function it_should_use_path_as_request_uri() { $path = 'anyPath'; + $request = $this->mapper->map($path, []); + + $this->assertEquals($path, $request->getUri()); + } + + /** + * @test + */ + public function it_should_send_request_as_post() + { + $request = $this->mapper->map('anyPath', []); + + $this->assertEquals(RequestHttpMethod::POST, $request->getMethod()); + } + + /** + * @test + */ + public function it_should_create_request_with_parameters() + { $builtInParameters = [ 'any1' => 'any', ]; @@ -36,10 +56,7 @@ public function it_should_create_post_request_with_parameters() 'any2' => 'any', ]; - $request = $this->mapper->map($path, $builtInParameters, $userParameters); - - $this->assertEquals($path, $request->getUri()); - $this->assertEquals(RequestHttpMethod::POST, $request->getMethod()); + $request = $this->mapper->map('anyPath', $builtInParameters, $userParameters); $this->assertEquals('any1=any&format=json&any2=any', $request->getBody()); } From 0f159fce9fb0daccbd56cfeb59b7c2dbff4ba1ec Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 10 Jan 2024 14:19:44 +0100 Subject: [PATCH 46/68] Assures that legacy request's format=json parameter occur as first in POST table --- .../RequestMapper/LegacyRequestMapper.php | 4 +- .../RequestMapper/LegacyRequestMapperTest.php | 43 ++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/Infrastructure/RequestMapper/LegacyRequestMapper.php b/src/Infrastructure/RequestMapper/LegacyRequestMapper.php index c59e314..b881e30 100644 --- a/src/Infrastructure/RequestMapper/LegacyRequestMapper.php +++ b/src/Infrastructure/RequestMapper/LegacyRequestMapper.php @@ -34,9 +34,7 @@ private function createRequest( array $builtInParameters, array $userParameters ): Request { - $builtInParameters['format'] = 'json'; - - $parameters = new QueryParametersData($builtInParameters, $userParameters); + $parameters = new QueryParametersData(['format' => 'json'] + $builtInParameters, $userParameters); return new Request($method, $path, $this->queryFormatter->format($parameters)); } diff --git a/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php b/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php index da06d89..9b5246a 100644 --- a/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php +++ b/tests/Unit/Infrastructure/RequestMapper/LegacyRequestMapperTest.php @@ -47,7 +47,46 @@ public function it_should_send_request_as_post() /** * @test */ - public function it_should_create_request_with_parameters() + public function it_should_always_set_format_json_parameter() + { + $builtInParameters = []; + $userParameters = []; + + $request = $this->mapper->map('anyPath', $builtInParameters, $userParameters); + + $this->assertEquals('format=json', $request->getBody()); + } + + /** + * @test + */ + public function it_should_prepend_format_parameter_to_built_in_parameters_when_none() + { + $builtInParameters = []; + $userParameters = ['any2' => 'any']; + + $request = $this->mapper->map('anyPath', $builtInParameters, $userParameters); + + $this->assertEquals('format=json&any2=any', $request->getBody()); + } + + /** + * @test + */ + public function it_should_prepend_format_parameter_to_built_in_parameters_when_set() + { + $builtInParameters = ['any1' => 'any']; + $userParameters = []; + + $request = $this->mapper->map('anyPath', $builtInParameters, $userParameters); + + $this->assertEquals('format=json&any1=any', $request->getBody()); + } + + /** + * @test + */ + public function it_should_merge_both_built_in_and_user_parameters() { $builtInParameters = [ 'any1' => 'any', @@ -58,6 +97,6 @@ public function it_should_create_request_with_parameters() $request = $this->mapper->map('anyPath', $builtInParameters, $userParameters); - $this->assertEquals('any1=any&format=json&any2=any', $request->getBody()); + $this->assertEquals('format=json&any1=any&any2=any', $request->getBody()); } } From c8dec1c88f3d4bcac83cf16f78fb2f77d2563645 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 10 Jan 2024 14:46:54 +0100 Subject: [PATCH 47/68] Fixes sending/scheduling smses in large amount --- CHANGELOG.md | 2 ++ src/Feature/Sms/Bag/ScheduleSmssBag.php | 2 +- src/Feature/Sms/Bag/SendSmssBag.php | 2 +- src/Feature/Sms/SmsHttpFeature.php | 5 ++++ tests/Fixture/PhoneNumberFixture.php | 5 ++++ .../Feature/Sms/SmsFeatureTest.php | 30 ++++++++----------- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b709a1..b5b892d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- sending/scheduling smses in large amount ## [3.0.9] - 2024-01-09 ### Fixed diff --git a/src/Feature/Sms/Bag/ScheduleSmssBag.php b/src/Feature/Sms/Bag/ScheduleSmssBag.php index b6fda24..6d2afc3 100644 --- a/src/Feature/Sms/Bag/ScheduleSmssBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmssBag.php @@ -29,7 +29,7 @@ #[\AllowDynamicProperties] class ScheduleSmssBag { - /** @var array */ + /** @var array|string */ public $to; /** @var DateTimeInterface */ diff --git a/src/Feature/Sms/Bag/SendSmssBag.php b/src/Feature/Sms/Bag/SendSmssBag.php index 53dc09b..5a48c72 100644 --- a/src/Feature/Sms/Bag/SendSmssBag.php +++ b/src/Feature/Sms/Bag/SendSmssBag.php @@ -29,7 +29,7 @@ #[\AllowDynamicProperties] class SendSmssBag { - /** @var array */ + /** @var array|string */ public $to; /** @var string */ diff --git a/src/Feature/Sms/SmsHttpFeature.php b/src/Feature/Sms/SmsHttpFeature.php index 10dea8b..b2e2299 100644 --- a/src/Feature/Sms/SmsHttpFeature.php +++ b/src/Feature/Sms/SmsHttpFeature.php @@ -110,6 +110,8 @@ public function sendFlashSmsToGroup(SendSmsToGroupBag $sendSmsToGroupBag): array public function sendSmss(SendSmssBag $sendSmssBag): array { + $sendSmssBag->to = implode(',', $sendSmssBag->to); + return array_map( [$this->dataFactoryProvider->provideSmsFactory(), 'createFromObject'], $this->makeRequest($sendSmssBag)->list @@ -118,6 +120,8 @@ public function sendSmss(SendSmssBag $sendSmssBag): array public function sendFlashSmss(SendSmssBag $sendSmssBag): array { + $sendSmssBag->to = implode(',', $sendSmssBag->to); + return array_map( [$this->dataFactoryProvider->provideSmsFactory(), 'createFromObject'], $this->makeRequest($sendSmssBag)->list @@ -146,6 +150,7 @@ public function scheduleSms(ScheduleSmsBag $scheduleSmsBag): Sms public function scheduleSmss(ScheduleSmssBag $scheduleSmssBag): array { + $scheduleSmssBag->to = implode(',', $scheduleSmssBag->to); $scheduleSmssBag->dateValidate = true; return array_map( diff --git a/tests/Fixture/PhoneNumberFixture.php b/tests/Fixture/PhoneNumberFixture.php index 2ab2941..9f06e1f 100644 --- a/tests/Fixture/PhoneNumberFixture.php +++ b/tests/Fixture/PhoneNumberFixture.php @@ -20,4 +20,9 @@ public static function anyValidMobile(): string { return (string)((int)self::$validMobile + self::$i++); } + + public static function xValidMobile(int $x): array + { + return array_map(function () {return self::anyValidMobile();}, range(1, $x)); + } } diff --git a/tests/Integration/Feature/Sms/SmsFeatureTest.php b/tests/Integration/Feature/Sms/SmsFeatureTest.php index e78a420..c5051f8 100644 --- a/tests/Integration/Feature/Sms/SmsFeatureTest.php +++ b/tests/Integration/Feature/Sms/SmsFeatureTest.php @@ -82,12 +82,12 @@ public function it_should_send_flash_sms() public function it_should_send_smss() { $smsFeature = self::$smsapiService->smsFeature(); - $sendSmssBag = $this->givenSmssToSend(); + $sendSmssBag = $this->givenSmssToSend(2); $sendSmssBag->test = true; $results = $smsFeature->sendSmss($sendSmssBag); - $this->assertCount(count($sendSmssBag->to), $results); + $this->assertCount(2, $results); } /** @@ -96,12 +96,12 @@ public function it_should_send_smss() public function it_should_send_flash_smss() { $smsFeature = self::$smsapiService->smsFeature(); - $sendSmssBag = $this->givenSmssToSend(); + $sendSmssBag = $this->givenSmssToSend(2); $sendSmssBag->test = true; $results = $smsFeature->sendFlashSmss($sendSmssBag); - $this->assertCount(count($sendSmssBag->to), $results); + $this->assertCount(2, $results); } /** @@ -110,7 +110,7 @@ public function it_should_send_flash_smss() public function it_should_not_receive_content_details_for_smss() { $smsFeature = self::$smsapiService->smsFeature(); - $sendSmsesBag = $this->givenSmssToSend(); + $sendSmsesBag = $this->givenSmssToSend(2); $sendSmsesBag->test = true; /** @var Sms[] $results */ @@ -142,12 +142,12 @@ public function it_should_schedule_sms() public function it_should_schedule_smss() { $smsFeature = self::$smsapiService->smsFeature(); - $scheduleSmssBag = $this->givenSmssToSchedule(); + $scheduleSmssBag = $this->givenSmssToSchedule(2); $scheduleSmssBag->test = true; $results = $smsFeature->scheduleSmss($scheduleSmssBag); - $this->assertCount(count($scheduleSmssBag->to), $results); + $this->assertCount(2, $results); } /** @@ -171,7 +171,7 @@ public function it_should_schedule_flash_sms() public function it_should_delete_scheduled_smss() { $smsFeature = self::$smsapiService->smsFeature(); - $scheduleSmssBag = $this->givenSmssToSchedule(); + $scheduleSmssBag = $this->givenSmssToSchedule(2); $results = $smsFeature->scheduleSmss($scheduleSmssBag); $smsIds = array_map(function (Sms $sms) { @@ -190,12 +190,9 @@ private function givenSmsToSend(): SendSmsBag return SendSmsBag::withMessage($someReceiver, 'some message'); } - private function givenSmssToSend(): SendSmssBag + private function givenSmssToSend(int $x): SendSmssBag { - $receivers = [ - PhoneNumberFixture::anyValidMobile(), - PhoneNumberFixture::anyValidMobile(), - ]; + $receivers = PhoneNumberFixture::xValidMobile($x); return SendSmssBag::withMessage($receivers, 'some message'); } @@ -206,13 +203,10 @@ private function givenSmsToSchedule(): ScheduleSmsBag return ScheduleSmsBag::withMessage($someDate, $someReceiver, 'some message'); } - private function givenSmssToSchedule(): ScheduleSmssBag + private function givenSmssToSchedule(int $x): ScheduleSmssBag { $someDate = new DateTime('+1 day noon'); - $receivers = [ - PhoneNumberFixture::anyValidMobile(), - PhoneNumberFixture::anyValidMobile(), - ]; + $receivers = PhoneNumberFixture::xValidMobile($x); return ScheduleSmssBag::withMessage($someDate, $receivers, 'some message'); } } From b228a1eba6a9bf9f38e5017bc012c0e4e9161715 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Thu, 11 Jan 2024 15:04:54 +0100 Subject: [PATCH 48/68] Adds PHP 8.3 support --- .github/workflows/tests.yml | 32 +------------------------------- CHANGELOG.md | 2 ++ build/php-8.3/Dockerfile | 4 ++-- composer.json | 2 +- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2a5899..ab815b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,6 +22,7 @@ jobs: - 8.0 - 8.1 - 8.2 + - 8.3 steps: - name: Checkout uses: actions/checkout@v3 @@ -45,34 +46,3 @@ jobs: - name: Running unit tests run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit - - tests-rc: - name: PHP ${{ matrix.php }} - runs-on: ubuntu-latest - strategy: - matrix: - php: - - 8.3 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.json') }} - - - name: Install dependencies - run: composer update --prefer-dist --no-interaction --ignore-platform-req=PHP - - - name: Running unit tests - run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b709a1..3b9d65e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- PHP-8.3 support ## [3.0.9] - 2024-01-09 ### Fixed diff --git a/build/php-8.3/Dockerfile b/build/php-8.3/Dockerfile index 7291d69..97fdde4 100644 --- a/build/php-8.3/Dockerfile +++ b/build/php-8.3/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest as composer -FROM php:8.3-rc-cli-alpine +FROM php:8.3-cli-alpine RUN apk update && \ apk upgrade && \ @@ -9,7 +9,7 @@ RUN apk update && \ make \ linux-headers -RUN pecl install xdebug-3.3.0alpha2 && \ +RUN pecl install xdebug-3.3.1 && \ pecl clear-cache && \ docker-php-ext-enable xdebug diff --git a/composer.json b/composer.json index bbb4849..31269cb 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": "^7 || ~8.0 || ~8.1 || ~8.2", + "php": "^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", "psr/http-message": "~1.0 || ~1.1 || ~2.0", From f6aaf36713b7e70a78c6f8622c6911ffaa376a67 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 15 Jan 2024 10:25:00 +0100 Subject: [PATCH 49/68] Changes request parameters documentation. Explains usage of optional parameters. --- README.md | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index bcd54ec..95ef8f3 100644 --- a/README.md +++ b/README.md @@ -185,50 +185,59 @@ $service->smsFeature() ->sendSms($sms); ``` -### How to send a SMS with optional from field? +### How to use request parameters? + +Request parameters are represented in a form of data transfer object. +DTOs can be found by searching for 'bag' postfixed classes. +Each bag may contain required and optional parameters. + +#### Required parameters + +Required parameters are that class public properties, usually accessible via some form of a setter or named constructor. +Each parameter can be also set directly by setting bag property, as in example: + +##### How to change SMS encoding? ```php from = 'Test'; +$sms->encoding = 'utf-8'; -$service->smsFeature() - ->sendSms($sms); ``` -For more usage examples take a look at client test suite. +#### Optional parameters -### How to use optional request parameters? +Some of request's optional parameters have been described by docblock's '@property' annotation. +You can always add any not documented here optional parameter by setting dynamic property to 'bag'. +Camel case property names are being converted to snake case on the fly. -Request parameters are represented in a form of data transfer object. -DTOs can be found by searching for 'bag' postfixed classes. -Each bag may contain required and optional parameters. -Required parameters are that class public properties, usually accessible via some form of a setter or named constructor. -Optional parameters are described by docblock's '@property' annotation. - -Each parameter can be also set directly by setting bag property, as in example: +##### How to send a SMS with optional from field? ```php encoding = 'utf-8'; +$sms->from = 'Test'; +$service->smsFeature() + ->sendSms($sms); ``` +For more usage examples take a look at client test suite. + ## How to use additional features? ### How to use proxy server? From da69e9ec19a641c5bc77158f34fd14b312ebbfe7 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 15 Jan 2024 11:24:02 +0100 Subject: [PATCH 50/68] Adds time restriction sms bag optional request parameter helpers --- CHANGELOG.md | 7 +++++++ src/Feature/Sms/Bag/ScheduleSmsBag.php | 1 + src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php | 1 + src/Feature/Sms/Bag/ScheduleSmssBag.php | 1 + src/Feature/Sms/Bag/SendSmsBag.php | 1 + src/Feature/Sms/Bag/SendSmsToGroupBag.php | 1 + src/Feature/Sms/Bag/SendSmssBag.php | 1 + 7 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b709a1..976f370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- `SendSmsBag::$timeRestriction` optional parameter +- `SendSmssBag::$timeRestriction` optional parameter +- `SendSmsToGroupBag::$timeRestriction` optional parameter +- `ScheduleSmsBag::$timeRestriction` optional parameter +- `ScheduleSmssBag::$timeRestriction` optional parameter +- `ScheduleSmsToGroupBag::$timeRestriction` optional parameter ## [3.0.9] - 2024-01-09 ### Fixed diff --git a/src/Feature/Sms/Bag/ScheduleSmsBag.php b/src/Feature/Sms/Bag/ScheduleSmsBag.php index 443bbb5..69257d4 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsBag.php @@ -24,6 +24,7 @@ * @property string $param2 * @property string $param3 * @property string $param4 + * @property string $timeRestriction */ #[\AllowDynamicProperties] class ScheduleSmsBag diff --git a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php index 28e138d..3412f21 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php @@ -20,6 +20,7 @@ * @property bool $normalize * @property string $notifyUrl * @property bool $test + * @property string $timeRestriction */ #[\AllowDynamicProperties] class ScheduleSmsToGroupBag diff --git a/src/Feature/Sms/Bag/ScheduleSmssBag.php b/src/Feature/Sms/Bag/ScheduleSmssBag.php index b6fda24..0706d54 100644 --- a/src/Feature/Sms/Bag/ScheduleSmssBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmssBag.php @@ -25,6 +25,7 @@ * @property array $param2 * @property array $param3 * @property array $param4 + * @property string $timeRestriction */ #[\AllowDynamicProperties] class ScheduleSmssBag diff --git a/src/Feature/Sms/Bag/SendSmsBag.php b/src/Feature/Sms/Bag/SendSmsBag.php index 23b0400..1391c37 100644 --- a/src/Feature/Sms/Bag/SendSmsBag.php +++ b/src/Feature/Sms/Bag/SendSmsBag.php @@ -24,6 +24,7 @@ * @property string $param2 * @property string $param3 * @property string $param4 + * @property string $timeRestriction */ #[\AllowDynamicProperties] class SendSmsBag diff --git a/src/Feature/Sms/Bag/SendSmsToGroupBag.php b/src/Feature/Sms/Bag/SendSmsToGroupBag.php index e462bbe..98b944e 100644 --- a/src/Feature/Sms/Bag/SendSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/SendSmsToGroupBag.php @@ -19,6 +19,7 @@ * @property bool $normalize * @property string $notifyUrl * @property bool $test + * @property string $timeRestriction */ #[\AllowDynamicProperties] class SendSmsToGroupBag diff --git a/src/Feature/Sms/Bag/SendSmssBag.php b/src/Feature/Sms/Bag/SendSmssBag.php index 53dc09b..da677e3 100644 --- a/src/Feature/Sms/Bag/SendSmssBag.php +++ b/src/Feature/Sms/Bag/SendSmssBag.php @@ -25,6 +25,7 @@ * @property array $param2 * @property array $param3 * @property array $param4 + * @property string $timeRestriction */ #[\AllowDynamicProperties] class SendSmssBag From 188cd3992cf50c3983c5f8cc9d24c4ad7266a7d9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 16 Jan 2024 14:50:00 +0100 Subject: [PATCH 51/68] Releases version 3.0.10 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dcaf74..2d75618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.10] - 2024-01-16 ### Added - PHP-8.3 support - `SendSmsBag::$timeRestriction` optional parameter diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..babace9 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.10'; public function smsapiPlService(string $apiToken): SmsapiPlService; From b53c3d13946fb556cd5472e44cd02f9cab711962 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Thu, 21 Mar 2024 10:47:09 +0100 Subject: [PATCH 52/68] Adds base URI decorator tests --- .../HttpClient/HttpClientRequestSpy.php | 27 +++ .../Decorator/BaseUriDecoratorTest.php | 210 ++++++++++++++++++ 2 files changed, 237 insertions(+) create mode 100644 tests/Helper/HttpClient/HttpClientRequestSpy.php create mode 100644 tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php diff --git a/tests/Helper/HttpClient/HttpClientRequestSpy.php b/tests/Helper/HttpClient/HttpClientRequestSpy.php new file mode 100644 index 0000000..375e984 --- /dev/null +++ b/tests/Helper/HttpClient/HttpClientRequestSpy.php @@ -0,0 +1,27 @@ +lastSentRequest = $request; + + return new Response(); + } + + public function getLastSentRequest(): RequestInterface + { + return $this->lastSentRequest; + } +} \ No newline at end of file diff --git a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php new file mode 100644 index 0000000..06dea5a --- /dev/null +++ b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php @@ -0,0 +1,210 @@ +sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals($expectedRequestSchema, $sentRequestSpy->getLastSentRequest()->getUri()->getScheme()); + } + + /** + * @test + * @testWith + * ["example.com", "example.com/endpoint"] + * ["example.com/base/", "example.com/base/endpoint"] + * ["example.com:80", "//example.com/endpoint"] + * ["example.com:80/base/", "//example.com/base/endpoint"] + */ + public function send_request_without_base_schema(string $baseUri, string $expectedRequestUri) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals('', $sentRequestSpy->getLastSentRequest()->getUri()->getScheme()); + } + + /** + * @test + * @testWith + * ["any://example.com", "any://example.com/endpoint", "example.com"] + * ["any://example.com:80", "any://example.com/endpoint", "example.com"] + * ["any://example", "any://example/endpoint", "example"] + * ["any://example:80", "any://example/endpoint", "example"] + * ["example.com", "example.com/endpoint", ""] + * ["example.com:80", "//example.com/endpoint", "example.com"] + * ["example", "example/endpoint", ""] + * ["example:80", "//example/endpoint", "example"] + * ["example.com/base/", "example.com/base/endpoint", ""] + * ["example.com:80/base/", "//example.com/base/endpoint", "example.com"] + * ["example/base/", "example/base/endpoint", ""] + * ["example:80/base/", "//example/base/endpoint", "example"] + */ + public function send_request_with_base_host(string $baseUri, string $expectedRequestUri, string $expectedRequestHost) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals($expectedRequestHost, $sentRequestSpy->getLastSentRequest()->getUri()->getHost()); + } + + /** + * @test + * @testWith + * ["any://", "/endpoint"] + * ["any:///", "/endpoint"] + * ["any://:80/", "/endpoint"] + */ + public function send_request_without_base_host(string $baseUri, string $expectedRequestUri) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals('', $sentRequestSpy->getLastSentRequest()->getUri()->getHost()); + } + + /** + * @test + * @testWith + * ["any://example.com:80", "any://example.com/endpoint", ""] + * ["any://example:80", "any://example/endpoint", ""] + * ["example.com:80", "//example.com/endpoint", ""] + * ["example:80", "//example/endpoint", ""] + * ["example.com:80/base/", "//example.com/base/endpoint", ""] + * ["example:80/base/", "//example/base/endpoint", ""] + */ + public function send_request_with_base_port(string $baseUri, string $expectedRequestUri, string $expectedRequestPort) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals($expectedRequestPort, $sentRequestSpy->getLastSentRequest()->getUri()->getPort()); + } + + /** + * @test + * @testWith + * ["any://example.com", "any://example.com/endpoint"] + * ["any://example", "any://example/endpoint"] + * ["any://example.com/base", "any://example.com/base/endpoint"] + * ["any://example/base", "any://example/base/endpoint"] + * ["example.com", "example.com/endpoint"] + * ["example", "example/endpoint"] + * ["example.com/base/", "example.com/base/endpoint"] + * ["example/base/", "example/base/endpoint"] + */ + public function send_request_without_base_port(string $baseUri, string $expectedRequestUri) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals('', $sentRequestSpy->getLastSentRequest()->getUri()->getPort()); + } + + /** + * @test + * @testWith + * ["any://example.com/base", "any://example.com/base/endpoint", "/base/endpoint"] + * ["any://example/base", "any://example/base/endpoint", "/base/endpoint"] + * ["example.com/base", "example.com/base/endpoint", "example.com/base/endpoint"] + * ["example/base", "example/base/endpoint", "example/base/endpoint"] + * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] + * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] + * ["example.com:80/base", "//example.com/base/endpoint", "/base/endpoint"] + * ["example:80/base", "//example/base/endpoint", "/base/endpoint"] + * ["any://example.com/base/", "any://example.com/base/endpoint", "/base/endpoint"] + * ["any://example/base/", "any://example/base/endpoint", "/base/endpoint"] + * ["example.com/base/", "example.com/base/endpoint", "example.com/base/endpoint"] + * ["example/base/", "example/base/endpoint", "example/base/endpoint"] + * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] + * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] + * ["example.com:80/base/", "//example.com/base/endpoint", "/base/endpoint"] + * ["example:80/base/", "//example/base/endpoint", "/base/endpoint"] + */ + public function send_request_with_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals($expectedRequestPath, $sentRequestSpy->getLastSentRequest()->getUri()->getPath()); + } + + /** + * @test + * @testWith + * ["any://example.com", "any://example.com/endpoint", "/endpoint"] + * ["any://example", "any://example/endpoint", "/endpoint"] + * ["example.com", "example.com/endpoint", "example.com/endpoint"] + * ["example", "example/endpoint", "example/endpoint"] + * ["any://example.com:80", "any://example.com/endpoint", "/endpoint"] + * ["any://example:80", "any://example/endpoint", "/endpoint"] + * ["example.com:80", "//example.com/endpoint", "/endpoint"] + * ["example:80", "//example/endpoint", "/endpoint"] + * ["any://example.com/", "any://example.com/endpoint", "/endpoint"] + * ["any://example/", "any://example/endpoint", "/endpoint"] + * ["example.com/", "example.com/endpoint", "example.com/endpoint"] + * ["example/", "example/endpoint", "example/endpoint"] + * ["any://example.com:80/", "any://example.com/endpoint", "/endpoint"] + * ["any://example:80/", "any://example/endpoint", "/endpoint"] + * ["example.com:80/", "//example.com/endpoint", "/endpoint"] + * ["example:80/", "//example/endpoint", "/endpoint"] + */ + public function send_request_without_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) + { + $sentRequestSpy = new HttpClientRequestSpy(); + $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); + + $this->sendRequestToAnyEndpoint($decorator); + + $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); + $this->assertEquals($expectedRequestPath, $sentRequestSpy->getLastSentRequest()->getUri()->getPath()); + } + + private function sendRequestToAnyEndpoint(BaseUriDecorator $decorator) + { + $request = new Request('ANY', 'endpoint'); + $decorator->sendRequest($request); + } +} \ No newline at end of file From f753335225d591062877485660d8ff2de2c6c1f2 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Thu, 21 Mar 2024 13:42:29 +0100 Subject: [PATCH 53/68] Adds service url scheme and host validation --- CHANGELOG.md | 7 +++ src/Curl/Exception/ClientException.php | 21 ++----- src/Curl/Exception/NetworkException.php | 6 +- src/Curl/Exception/RequestException.php | 6 +- src/Curl/HttpClient.php | 4 +- .../HttpClient/ClientException.php | 30 +++++++++ .../HttpClient/Decorator/BaseUriDecorator.php | 5 ++ .../HttpClient/NetworkException.php | 15 +++++ .../HttpClient/RequestException.php | 15 +++++ src/SmsapiClient.php | 2 +- tests/SmsapiClientIntegrationTestCase.php | 4 -- .../Decorator/BaseUriDecoratorTest.php | 62 +++---------------- 12 files changed, 94 insertions(+), 83 deletions(-) create mode 100644 src/Infrastructure/HttpClient/ClientException.php create mode 100644 src/Infrastructure/HttpClient/NetworkException.php create mode 100644 src/Infrastructure/HttpClient/RequestException.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d75618..a46c0c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Added +- service url scheme and host validation + +### Changed +- PSR-18 HTTP client related exceptions namespace moved + ## [3.0.10] - 2024-01-16 ### Added - PHP-8.3 support diff --git a/src/Curl/Exception/ClientException.php b/src/Curl/Exception/ClientException.php index 4da31c7..0d2726a 100644 --- a/src/Curl/Exception/ClientException.php +++ b/src/Curl/Exception/ClientException.php @@ -4,27 +4,14 @@ namespace Smsapi\Client\Curl\Exception; -use Exception; -use Psr\Http\Client\ClientExceptionInterface; -use Psr\Http\Message\RequestInterface; +use Smsapi\Client\Infrastructure\HttpClient\ClientException as HttpClientException; /** * @api + * @deprecated + * @see HttpClientException */ -class ClientException extends Exception implements ClientExceptionInterface +class ClientException extends HttpClientException { - private $request; - public static function withRequest(string $message, RequestInterface $request): self - { - $exception = new self($message); - $exception->request = $request; - - return $exception; - } - - public function getRequest(): RequestInterface - { - return $this->request; - } } \ No newline at end of file diff --git a/src/Curl/Exception/NetworkException.php b/src/Curl/Exception/NetworkException.php index a4b7421..9d1729a 100644 --- a/src/Curl/Exception/NetworkException.php +++ b/src/Curl/Exception/NetworkException.php @@ -4,12 +4,14 @@ namespace Smsapi\Client\Curl\Exception; -use Psr\Http\Client\NetworkExceptionInterface; +use Smsapi\Client\Infrastructure\HttpClient\NetworkException as HttpClientNetworkException; /** * @api + * @deprecated + * @see HttpClientNetworkException */ -class NetworkException extends ClientException implements NetworkExceptionInterface +class NetworkException extends HttpClientNetworkException { } \ No newline at end of file diff --git a/src/Curl/Exception/RequestException.php b/src/Curl/Exception/RequestException.php index 2ea1aa5..0b96f1e 100644 --- a/src/Curl/Exception/RequestException.php +++ b/src/Curl/Exception/RequestException.php @@ -4,12 +4,14 @@ namespace Smsapi\Client\Curl\Exception; -use Psr\Http\Client\RequestExceptionInterface; +use Smsapi\Client\Infrastructure\HttpClient\RequestException as HttpClientRequestException; /** * @api + * @deprecated + * @see HttpClientRequestException */ -class RequestException extends ClientException implements RequestExceptionInterface +class RequestException extends HttpClientRequestException { } \ No newline at end of file diff --git a/src/Curl/HttpClient.php b/src/Curl/HttpClient.php index b2f9af7..2ef3ca6 100644 --- a/src/Curl/HttpClient.php +++ b/src/Curl/HttpClient.php @@ -8,8 +8,8 @@ use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -use Smsapi\Client\Curl\Exception\NetworkException; -use Smsapi\Client\Curl\Exception\RequestException; +use Smsapi\Client\Infrastructure\HttpClient\NetworkException; +use Smsapi\Client\Infrastructure\HttpClient\RequestException; /** * @internal diff --git a/src/Infrastructure/HttpClient/ClientException.php b/src/Infrastructure/HttpClient/ClientException.php new file mode 100644 index 0000000..a17f164 --- /dev/null +++ b/src/Infrastructure/HttpClient/ClientException.php @@ -0,0 +1,30 @@ +request = $request; + + return $exception; + } + + public function getRequest(): RequestInterface + { + return $this->request; + } +} \ No newline at end of file diff --git a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php index 75b50db..f2f4ae0 100644 --- a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php +++ b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php @@ -7,6 +7,7 @@ use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; +use Smsapi\Client\Infrastructure\HttpClient\RequestException; /** * @internal @@ -37,6 +38,10 @@ private function prependBaseUri(RequestInterface $request): RequestInterface $scheme = $baseUriParts['scheme'] ?? ''; $host = $baseUriParts['host'] ?? ''; + if (!$scheme || !$host) { + throw RequestException::withRequest("Base URI has no scheme or host", $request); + } + $basePath = $baseUriParts['path'] ?? ''; $basePath = rtrim($basePath, '/'); diff --git a/src/Infrastructure/HttpClient/NetworkException.php b/src/Infrastructure/HttpClient/NetworkException.php new file mode 100644 index 0000000..8464188 --- /dev/null +++ b/src/Infrastructure/HttpClient/NetworkException.php @@ -0,0 +1,15 @@ +expectException(RequestException::class); + $this->expectExceptionMessage('Base URI has no scheme or host'); $this->sendRequestToAnyEndpoint($decorator); - - $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); - $this->assertEquals('', $sentRequestSpy->getLastSentRequest()->getUri()->getScheme()); } /** @@ -58,14 +61,6 @@ public function send_request_without_base_schema(string $baseUri, string $expect * ["any://example.com:80", "any://example.com/endpoint", "example.com"] * ["any://example", "any://example/endpoint", "example"] * ["any://example:80", "any://example/endpoint", "example"] - * ["example.com", "example.com/endpoint", ""] - * ["example.com:80", "//example.com/endpoint", "example.com"] - * ["example", "example/endpoint", ""] - * ["example:80", "//example/endpoint", "example"] - * ["example.com/base/", "example.com/base/endpoint", ""] - * ["example.com:80/base/", "//example.com/base/endpoint", "example.com"] - * ["example/base/", "example/base/endpoint", ""] - * ["example:80/base/", "//example/base/endpoint", "example"] */ public function send_request_with_base_host(string $baseUri, string $expectedRequestUri, string $expectedRequestHost) { @@ -78,33 +73,11 @@ public function send_request_with_base_host(string $baseUri, string $expectedReq $this->assertEquals($expectedRequestHost, $sentRequestSpy->getLastSentRequest()->getUri()->getHost()); } - /** - * @test - * @testWith - * ["any://", "/endpoint"] - * ["any:///", "/endpoint"] - * ["any://:80/", "/endpoint"] - */ - public function send_request_without_base_host(string $baseUri, string $expectedRequestUri) - { - $sentRequestSpy = new HttpClientRequestSpy(); - $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); - - $this->sendRequestToAnyEndpoint($decorator); - - $this->assertEquals($expectedRequestUri, (string)$sentRequestSpy->getLastSentRequest()->getUri()); - $this->assertEquals('', $sentRequestSpy->getLastSentRequest()->getUri()->getHost()); - } - /** * @test * @testWith * ["any://example.com:80", "any://example.com/endpoint", ""] * ["any://example:80", "any://example/endpoint", ""] - * ["example.com:80", "//example.com/endpoint", ""] - * ["example:80", "//example/endpoint", ""] - * ["example.com:80/base/", "//example.com/base/endpoint", ""] - * ["example:80/base/", "//example/base/endpoint", ""] */ public function send_request_with_base_port(string $baseUri, string $expectedRequestUri, string $expectedRequestPort) { @@ -124,10 +97,6 @@ public function send_request_with_base_port(string $baseUri, string $expectedReq * ["any://example", "any://example/endpoint"] * ["any://example.com/base", "any://example.com/base/endpoint"] * ["any://example/base", "any://example/base/endpoint"] - * ["example.com", "example.com/endpoint"] - * ["example", "example/endpoint"] - * ["example.com/base/", "example.com/base/endpoint"] - * ["example/base/", "example/base/endpoint"] */ public function send_request_without_base_port(string $baseUri, string $expectedRequestUri) { @@ -144,21 +113,12 @@ public function send_request_without_base_port(string $baseUri, string $expected * @test * @testWith * ["any://example.com/base", "any://example.com/base/endpoint", "/base/endpoint"] - * ["any://example/base", "any://example/base/endpoint", "/base/endpoint"] - * ["example.com/base", "example.com/base/endpoint", "example.com/base/endpoint"] - * ["example/base", "example/base/endpoint", "example/base/endpoint"] * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] - * ["example.com:80/base", "//example.com/base/endpoint", "/base/endpoint"] - * ["example:80/base", "//example/base/endpoint", "/base/endpoint"] * ["any://example.com/base/", "any://example.com/base/endpoint", "/base/endpoint"] * ["any://example/base/", "any://example/base/endpoint", "/base/endpoint"] - * ["example.com/base/", "example.com/base/endpoint", "example.com/base/endpoint"] - * ["example/base/", "example/base/endpoint", "example/base/endpoint"] * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] - * ["example.com:80/base/", "//example.com/base/endpoint", "/base/endpoint"] - * ["example:80/base/", "//example/base/endpoint", "/base/endpoint"] */ public function send_request_with_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) { @@ -176,20 +136,12 @@ public function send_request_with_base_path(string $baseUri, string $expectedReq * @testWith * ["any://example.com", "any://example.com/endpoint", "/endpoint"] * ["any://example", "any://example/endpoint", "/endpoint"] - * ["example.com", "example.com/endpoint", "example.com/endpoint"] - * ["example", "example/endpoint", "example/endpoint"] * ["any://example.com:80", "any://example.com/endpoint", "/endpoint"] * ["any://example:80", "any://example/endpoint", "/endpoint"] - * ["example.com:80", "//example.com/endpoint", "/endpoint"] - * ["example:80", "//example/endpoint", "/endpoint"] * ["any://example.com/", "any://example.com/endpoint", "/endpoint"] * ["any://example/", "any://example/endpoint", "/endpoint"] - * ["example.com/", "example.com/endpoint", "example.com/endpoint"] - * ["example/", "example/endpoint", "example/endpoint"] * ["any://example.com:80/", "any://example.com/endpoint", "/endpoint"] * ["any://example:80/", "any://example/endpoint", "/endpoint"] - * ["example.com:80/", "//example.com/endpoint", "/endpoint"] - * ["example:80/", "//example/endpoint", "/endpoint"] */ public function send_request_without_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) { From ac878bc13cc9ee0500301e59fe1b230afa130fa9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 22 Mar 2024 14:20:27 +0100 Subject: [PATCH 54/68] Adds service url scheme and host validation --- .../HttpClient/Decorator/BaseUriDecorator.php | 8 ++++---- .../HttpClient/Decorator/BaseUriDecoratorTest.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php index f2f4ae0..1fa91f9 100644 --- a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php +++ b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php @@ -34,14 +34,14 @@ private function prependBaseUri(RequestInterface $request): RequestInterface { $uri = $request->getUri(); + if (!filter_var($this->baseUri, FILTER_VALIDATE_URL)) { + throw RequestException::withRequest("Invalid Base URI", $request); + } + $baseUriParts = parse_url($this->baseUri); $scheme = $baseUriParts['scheme'] ?? ''; $host = $baseUriParts['host'] ?? ''; - if (!$scheme || !$host) { - throw RequestException::withRequest("Base URI has no scheme or host", $request); - } - $basePath = $baseUriParts['path'] ?? ''; $basePath = rtrim($basePath, '/'); diff --git a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php index 61260ef..f5f1c59 100644 --- a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php +++ b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php @@ -44,13 +44,13 @@ public function send_request_with_base_schema(string $baseUri, string $expectedR * ["any:///"] * ["any://:80/"] */ - public function send_request_without_base_schema_or_host(string $baseUri) + public function dont_send_request_without_base_schema_or_host(string $baseUri) { $sentRequestSpy = new HttpClientRequestSpy(); $decorator = new BaseUriDecorator($sentRequestSpy, $baseUri); $this->expectException(RequestException::class); - $this->expectExceptionMessage('Base URI has no scheme or host'); + $this->expectExceptionMessage('Invalid Base URI'); $this->sendRequestToAnyEndpoint($decorator); } From 37a0550d954b299f80a7ae539dff14c4d34111b9 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 22 Mar 2024 14:57:21 +0100 Subject: [PATCH 55/68] Adds service url scheme and host validation --- .../HttpClient/Decorator/BaseUriDecoratorTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php index f5f1c59..677852f 100644 --- a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php +++ b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php @@ -36,10 +36,10 @@ public function send_request_with_base_schema(string $baseUri, string $expectedR /** * @test * @testWith - * ["example.com", "example.com/endpoint"] - * ["example.com/base/", "example.com/base/endpoint"] - * ["example.com:80", "//example.com/endpoint"] - * ["example.com:80/base/", "//example.com/base/endpoint"] + * ["example.com"] + * ["example.com/base/"] + * ["example.com:80"] + * ["example.com:80/base/"] * ["any://"] * ["any:///"] * ["any://:80/"] From 6d4b6200bea41043554aa82b9958556c4b07eace Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 22 Mar 2024 15:36:00 +0100 Subject: [PATCH 56/68] Adds service url with port support --- CHANGELOG.md | 1 + src/Curl/HttpClient.php | 8 +++++- .../HttpClient/Decorator/BaseUriDecorator.php | 2 ++ .../Decorator/BaseUriDecoratorTest.php | 28 +++++++++---------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a46c0c1..b9497f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] ### Added - service url scheme and host validation +- service url with port support ### Changed - PSR-18 HTTP client related exceptions namespace moved diff --git a/src/Curl/HttpClient.php b/src/Curl/HttpClient.php index 2ef3ca6..7bfadcb 100644 --- a/src/Curl/HttpClient.php +++ b/src/Curl/HttpClient.php @@ -34,7 +34,13 @@ public function sendRequest(RequestInterface $request): ResponseInterface private function prepareRequestHttpClient(RequestInterface $request) { - $url = sprintf("%s://%s%s", $request->getUri()->getScheme(), $request->getUri()->getHost(), $request->getRequestTarget()); + $url = strtr("{scheme}://{host}{port}{path}", [ + '{scheme}' => $request->getUri()->getScheme(), + '{host}' => $request->getUri()->getHost(), + '{port}' => $request->getUri()->getPort() ? ':' . $request->getUri()->getPort() : '', + '{path}' => $request->getRequestTarget() + ]); + $httpClient = curl_init($url); if ($httpClient === false) { diff --git a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php index 1fa91f9..79cc2fc 100644 --- a/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php +++ b/src/Infrastructure/HttpClient/Decorator/BaseUriDecorator.php @@ -42,10 +42,12 @@ private function prependBaseUri(RequestInterface $request): RequestInterface $scheme = $baseUriParts['scheme'] ?? ''; $host = $baseUriParts['host'] ?? ''; + $port = $baseUriParts['port'] ?? null; $basePath = $baseUriParts['path'] ?? ''; $basePath = rtrim($basePath, '/'); $uri = $uri->withPath($basePath . '/' . $uri->getPath()); + $uri = $uri->withPort($port); $uri = $uri->withHost($host); $uri = $uri->withScheme($scheme); diff --git a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php index 677852f..0e538bd 100644 --- a/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php +++ b/tests/Unit/Infrastructure/HttpClient/Decorator/BaseUriDecoratorTest.php @@ -19,8 +19,8 @@ class BaseUriDecoratorTest extends TestCase * ["http://example.com", "http://example.com/endpoint", "http"] * ["any://example.com", "any://example.com/endpoint", "any"] * ["any://example.com/base/", "any://example.com/base/endpoint", "any"] - * ["any://example.com:80", "any://example.com/endpoint", "any"] - * ["any://example.com:80/base/", "any://example.com/base/endpoint", "any"] + * ["any://example.com:80", "any://example.com:80/endpoint", "any"] + * ["any://example.com:80/base/", "any://example.com:80/base/endpoint", "any"] */ public function send_request_with_base_schema(string $baseUri, string $expectedRequestUri, string $expectedRequestSchema) { @@ -58,9 +58,9 @@ public function dont_send_request_without_base_schema_or_host(string $baseUri) * @test * @testWith * ["any://example.com", "any://example.com/endpoint", "example.com"] - * ["any://example.com:80", "any://example.com/endpoint", "example.com"] + * ["any://example.com:80", "any://example.com:80/endpoint", "example.com"] * ["any://example", "any://example/endpoint", "example"] - * ["any://example:80", "any://example/endpoint", "example"] + * ["any://example:80", "any://example:80/endpoint", "example"] */ public function send_request_with_base_host(string $baseUri, string $expectedRequestUri, string $expectedRequestHost) { @@ -76,8 +76,8 @@ public function send_request_with_base_host(string $baseUri, string $expectedReq /** * @test * @testWith - * ["any://example.com:80", "any://example.com/endpoint", ""] - * ["any://example:80", "any://example/endpoint", ""] + * ["any://example.com:80", "any://example.com:80/endpoint", "80"] + * ["any://example:80", "any://example:80/endpoint", "80"] */ public function send_request_with_base_port(string $baseUri, string $expectedRequestUri, string $expectedRequestPort) { @@ -113,12 +113,12 @@ public function send_request_without_base_port(string $baseUri, string $expected * @test * @testWith * ["any://example.com/base", "any://example.com/base/endpoint", "/base/endpoint"] - * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] - * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] + * ["any://example.com:80/base/", "any://example.com:80/base/endpoint", "/base/endpoint"] + * ["any://example:80/base", "any://example:80/base/endpoint", "/base/endpoint"] * ["any://example.com/base/", "any://example.com/base/endpoint", "/base/endpoint"] * ["any://example/base/", "any://example/base/endpoint", "/base/endpoint"] - * ["any://example.com:80/base/", "any://example.com/base/endpoint", "/base/endpoint"] - * ["any://example:80/base", "any://example/base/endpoint", "/base/endpoint"] + * ["any://example.com:80/base/", "any://example.com:80/base/endpoint", "/base/endpoint"] + * ["any://example:80/base", "any://example:80/base/endpoint", "/base/endpoint"] */ public function send_request_with_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) { @@ -136,12 +136,12 @@ public function send_request_with_base_path(string $baseUri, string $expectedReq * @testWith * ["any://example.com", "any://example.com/endpoint", "/endpoint"] * ["any://example", "any://example/endpoint", "/endpoint"] - * ["any://example.com:80", "any://example.com/endpoint", "/endpoint"] - * ["any://example:80", "any://example/endpoint", "/endpoint"] + * ["any://example.com:80", "any://example.com:80/endpoint", "/endpoint"] + * ["any://example:80", "any://example:80/endpoint", "/endpoint"] * ["any://example.com/", "any://example.com/endpoint", "/endpoint"] * ["any://example/", "any://example/endpoint", "/endpoint"] - * ["any://example.com:80/", "any://example.com/endpoint", "/endpoint"] - * ["any://example:80/", "any://example/endpoint", "/endpoint"] + * ["any://example.com:80/", "any://example.com:80/endpoint", "/endpoint"] + * ["any://example:80/", "any://example:80/endpoint", "/endpoint"] */ public function send_request_without_base_path(string $baseUri, string $expectedRequestUri, string $expectedRequestPath) { From 8536bbdf01cb373ba9df6fe23821d80cf35bd280 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Wed, 27 Mar 2024 10:19:53 +0100 Subject: [PATCH 57/68] Releases version 3.0.11 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9497f1..0e0c6f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.11] - 2024-03-27 ### Added - service url scheme and host validation - service url with port support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..e67e0c2 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.11'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 23469da106cc04ceee08c744c7555c1a6da92b3b Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 1 Jul 2025 12:14:15 +0000 Subject: [PATCH 58/68] Run tests against PHP 8.4 --- .github/workflows/tests.yml | 1 + build/Makefile | 3 +++ build/docker-compose.yml | 7 +++++++ build/php-8.4/Dockerfile | 18 ++++++++++++++++++ build/php-8.4/Makefile | 10 ++++++++++ 5 files changed, 39 insertions(+) create mode 100644 build/php-8.4/Dockerfile create mode 100644 build/php-8.4/Makefile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab815b5..e1fed77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: - 8.1 - 8.2 - 8.3 + - 8.4 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/build/Makefile b/build/Makefile index 21b9005..9c90389 100644 --- a/build/Makefile +++ b/build/Makefile @@ -9,6 +9,7 @@ include $(CURDIR)/php-8.0/Makefile include $(CURDIR)/php-8.1/Makefile include $(CURDIR)/php-8.2/Makefile include $(CURDIR)/php-8.3/Makefile +include $(CURDIR)/php-8.4/Makefile help: @grep -hE '^[a-zA-Z0-9_.-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -28,6 +29,7 @@ test: ## test all against all php images $(MAKE) test-php-8.1 $(MAKE) test-php-8.2 $(MAKE) test-php-8.3 + $(MAKE) test-php-8.4 test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-7.0 SUITE=unit @@ -39,5 +41,6 @@ test-unit: ## test unit suite against all php images $(MAKE) test-suite-php-8.1 SUITE=unit $(MAKE) test-suite-php-8.2 SUITE=unit $(MAKE) test-suite-php-8.3 SUITE=unit + $(MAKE) test-suite-php-8.4 SUITE=unit .DEFAULT_GOAL := help diff --git a/build/docker-compose.yml b/build/docker-compose.yml index af9fe64..d3205f2 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -63,4 +63,11 @@ services: context: php-8.3 volumes: - ..:/app + network_mode: host + + php-8.4: + build: + context: php-8.4 + volumes: + - ..:/app network_mode: host \ No newline at end of file diff --git a/build/php-8.4/Dockerfile b/build/php-8.4/Dockerfile new file mode 100644 index 0000000..30effb1 --- /dev/null +++ b/build/php-8.4/Dockerfile @@ -0,0 +1,18 @@ +FROM composer:latest AS composer +FROM php:8.4-cli-alpine + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + autoconf \ + g++ \ + make \ + linux-headers + +RUN pecl install xdebug-3.4.4 && \ + pecl clear-cache && \ + docker-php-ext-enable xdebug + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-8.4/Makefile b/build/php-8.4/Makefile new file mode 100644 index 0000000..326100b --- /dev/null +++ b/build/php-8.4/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.4 test-php-8.4 test-suite-php-8.4 + +prepare-php-8.4: ## load dependencies with php 8.4 + docker-compose run -T php-8.4 /usr/bin/composer update --ignore-platform-req=PHP + +test-php-8.4: prepare-php-8.4 ## run tests against php 8.4 + docker-compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-8.4: prepare-php-8.4 ## run suite tests against php 8.4, ex: make test-suite-php-8.4 SUITE="unit" + docker-compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file From 2f021ba2a0a3bb4329f80f1b4305ad81d4931992 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 1 Jul 2025 12:29:44 +0000 Subject: [PATCH 59/68] Run test workflow on pull request to master branch --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e1fed77..8abd84f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,6 +6,9 @@ on: - main - master pull_request: + branches: + - main + - master jobs: tests: From 22e79d6ff72447ab20167cb81c4596c23594e07d Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 1 Jul 2025 13:21:08 +0000 Subject: [PATCH 60/68] Mark methods that are to be changed in next major release. Implicitly marking parameter as nullable is deprecated since PHP 8.4. --- src/Feature/Contacts/ContactsFeature.php | 1 + src/Feature/Contacts/ContactsHttpFeature.php | 3 +++ src/Feature/Sms/Bag/ScheduleSmsBag.php | 3 +++ src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php | 3 +++ src/Feature/Sms/Bag/ScheduleSmssBag.php | 3 +++ src/Feature/Sms/Bag/SendSmsBag.php | 3 +++ src/Feature/Sms/Bag/SendSmsToGroupBag.php | 3 +++ src/Feature/Sms/Bag/SendSmssBag.php | 3 +++ 8 files changed, 22 insertions(+) diff --git a/src/Feature/Contacts/ContactsFeature.php b/src/Feature/Contacts/ContactsFeature.php index a1f2bfd..ed17b33 100644 --- a/src/Feature/Contacts/ContactsFeature.php +++ b/src/Feature/Contacts/ContactsFeature.php @@ -19,6 +19,7 @@ interface ContactsFeature { /** * @return Contact[] + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 */ public function findContacts(FindContactsBag $findContactsBag = null): array; diff --git a/src/Feature/Contacts/ContactsHttpFeature.php b/src/Feature/Contacts/ContactsHttpFeature.php index 7d2f38c..86360bb 100644 --- a/src/Feature/Contacts/ContactsHttpFeature.php +++ b/src/Feature/Contacts/ContactsHttpFeature.php @@ -31,6 +31,9 @@ public function __construct(RestRequestExecutor $restRequestExecutor, DataFactor $this->dataFactoryProvider = $dataFactoryProvider; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function findContacts(FindContactsBag $findContactsBag = null): array { $result = $this->restRequestExecutor->read('contacts', (array)$findContactsBag); diff --git a/src/Feature/Sms/Bag/ScheduleSmsBag.php b/src/Feature/Sms/Bag/ScheduleSmsBag.php index 69257d4..3512917 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsBag.php @@ -67,6 +67,9 @@ public function setParams(array $params): self return $this; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(string $idx, bool $checkIdx = null): self { $this->idx = [$idx]; diff --git a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php index 3412f21..536ec8a 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php @@ -55,6 +55,9 @@ public static function withTemplateName(DateTimeInterface $scheduleAt, string $g return $bag; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(string $idx, bool $checkIdx = null): self { $this->idx = [$idx]; diff --git a/src/Feature/Sms/Bag/ScheduleSmssBag.php b/src/Feature/Sms/Bag/ScheduleSmssBag.php index 3a1220d..d274e49 100644 --- a/src/Feature/Sms/Bag/ScheduleSmssBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmssBag.php @@ -68,6 +68,9 @@ public function setParams(array $params): self return $this; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(array $idx, bool $checkIdx = null): self { $this->idx = $idx; diff --git a/src/Feature/Sms/Bag/SendSmsBag.php b/src/Feature/Sms/Bag/SendSmsBag.php index 1391c37..eb4cef2 100644 --- a/src/Feature/Sms/Bag/SendSmsBag.php +++ b/src/Feature/Sms/Bag/SendSmsBag.php @@ -62,6 +62,9 @@ public function setParams(array $params): self return $this; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(string $idx, bool $checkIdx = null): self { $this->idx = [$idx]; diff --git a/src/Feature/Sms/Bag/SendSmsToGroupBag.php b/src/Feature/Sms/Bag/SendSmsToGroupBag.php index 98b944e..b41768d 100644 --- a/src/Feature/Sms/Bag/SendSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/SendSmsToGroupBag.php @@ -48,6 +48,9 @@ public static function withTemplateName(string $group, string $templateName): se return $bag; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(string $idx, bool $checkIdx = null): self { $this->idx = [$idx]; diff --git a/src/Feature/Sms/Bag/SendSmssBag.php b/src/Feature/Sms/Bag/SendSmssBag.php index 383d6c0..d3cb370 100644 --- a/src/Feature/Sms/Bag/SendSmssBag.php +++ b/src/Feature/Sms/Bag/SendSmssBag.php @@ -63,6 +63,9 @@ public function setParams(array $params): self return $this; } + /** + * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + */ public function setExternalId(array $idx, bool $checkIdx = null): self { $this->idx = $idx; From 7d1510fe2bc004cea12c8756fd6c3da42a843f90 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 1 Jul 2025 13:24:08 +0000 Subject: [PATCH 61/68] Fix typo --- src/Feature/Contacts/ContactsFeature.php | 2 +- src/Feature/Contacts/ContactsHttpFeature.php | 2 +- src/Feature/Sms/Bag/ScheduleSmsBag.php | 2 +- src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php | 2 +- src/Feature/Sms/Bag/ScheduleSmssBag.php | 2 +- src/Feature/Sms/Bag/SendSmsBag.php | 2 +- src/Feature/Sms/Bag/SendSmsToGroupBag.php | 2 +- src/Feature/Sms/Bag/SendSmssBag.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Feature/Contacts/ContactsFeature.php b/src/Feature/Contacts/ContactsFeature.php index ed17b33..df9de39 100644 --- a/src/Feature/Contacts/ContactsFeature.php +++ b/src/Feature/Contacts/ContactsFeature.php @@ -19,7 +19,7 @@ interface ContactsFeature { /** * @return Contact[] - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function findContacts(FindContactsBag $findContactsBag = null): array; diff --git a/src/Feature/Contacts/ContactsHttpFeature.php b/src/Feature/Contacts/ContactsHttpFeature.php index 86360bb..7c73a56 100644 --- a/src/Feature/Contacts/ContactsHttpFeature.php +++ b/src/Feature/Contacts/ContactsHttpFeature.php @@ -32,7 +32,7 @@ public function __construct(RestRequestExecutor $restRequestExecutor, DataFactor } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function findContacts(FindContactsBag $findContactsBag = null): array { diff --git a/src/Feature/Sms/Bag/ScheduleSmsBag.php b/src/Feature/Sms/Bag/ScheduleSmsBag.php index 3512917..2ce4b52 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsBag.php @@ -68,7 +68,7 @@ public function setParams(array $params): self } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(string $idx, bool $checkIdx = null): self { diff --git a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php index 536ec8a..0981fd2 100644 --- a/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmsToGroupBag.php @@ -56,7 +56,7 @@ public static function withTemplateName(DateTimeInterface $scheduleAt, string $g } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(string $idx, bool $checkIdx = null): self { diff --git a/src/Feature/Sms/Bag/ScheduleSmssBag.php b/src/Feature/Sms/Bag/ScheduleSmssBag.php index d274e49..b214567 100644 --- a/src/Feature/Sms/Bag/ScheduleSmssBag.php +++ b/src/Feature/Sms/Bag/ScheduleSmssBag.php @@ -69,7 +69,7 @@ public function setParams(array $params): self } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(array $idx, bool $checkIdx = null): self { diff --git a/src/Feature/Sms/Bag/SendSmsBag.php b/src/Feature/Sms/Bag/SendSmsBag.php index eb4cef2..9ac48b5 100644 --- a/src/Feature/Sms/Bag/SendSmsBag.php +++ b/src/Feature/Sms/Bag/SendSmsBag.php @@ -63,7 +63,7 @@ public function setParams(array $params): self } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(string $idx, bool $checkIdx = null): self { diff --git a/src/Feature/Sms/Bag/SendSmsToGroupBag.php b/src/Feature/Sms/Bag/SendSmsToGroupBag.php index b41768d..a6da846 100644 --- a/src/Feature/Sms/Bag/SendSmsToGroupBag.php +++ b/src/Feature/Sms/Bag/SendSmsToGroupBag.php @@ -49,7 +49,7 @@ public static function withTemplateName(string $group, string $templateName): se } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(string $idx, bool $checkIdx = null): self { diff --git a/src/Feature/Sms/Bag/SendSmssBag.php b/src/Feature/Sms/Bag/SendSmssBag.php index d3cb370..279bc53 100644 --- a/src/Feature/Sms/Bag/SendSmssBag.php +++ b/src/Feature/Sms/Bag/SendSmssBag.php @@ -64,7 +64,7 @@ public function setParams(array $params): self } /** - * @todo method signature to be changed in next major release as implicitly marking parameters as nullable is deprecated since PHP 8.4 + * @todo method signature to be changed in next major release as implicitly marking parameter as nullable is deprecated since PHP 8.4 */ public function setExternalId(array $idx, bool $checkIdx = null): self { From e551d3af414a0f8c4f6deb22d9bba39937b8e8b3 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Tue, 1 Jul 2025 14:06:53 +0000 Subject: [PATCH 62/68] Add PHP 8.4 support. --- CHANGELOG.md | 4 ++++ build/php-8.3/Makefile | 2 +- build/php-8.4/Makefile | 2 +- composer.json | 2 +- src/SmsapiClient.php | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0c6f8..4231563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Added +- PHP-8.4 support + ## [3.0.11] - 2024-03-27 ### Added - service url scheme and host validation diff --git a/build/php-8.3/Makefile b/build/php-8.3/Makefile index edb5c99..3b913f1 100644 --- a/build/php-8.3/Makefile +++ b/build/php-8.3/Makefile @@ -1,7 +1,7 @@ .PHONY: prepare-php-8.3 test-php-8.3 test-suite-php-8.3 prepare-php-8.3: ## load dependencies with php 8.3 - docker-compose run -T php-8.3 /usr/bin/composer update --ignore-platform-req=PHP + docker-compose run -T php-8.3 /usr/bin/composer update test-php-8.3: prepare-php-8.3 ## run tests against php 8.3 docker-compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml diff --git a/build/php-8.4/Makefile b/build/php-8.4/Makefile index 326100b..05d45e3 100644 --- a/build/php-8.4/Makefile +++ b/build/php-8.4/Makefile @@ -1,7 +1,7 @@ .PHONY: prepare-php-8.4 test-php-8.4 test-suite-php-8.4 prepare-php-8.4: ## load dependencies with php 8.4 - docker-compose run -T php-8.4 /usr/bin/composer update --ignore-platform-req=PHP + docker-compose run -T php-8.4 /usr/bin/composer update test-php-8.4: prepare-php-8.4 ## run tests against php 8.4 docker-compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml diff --git a/composer.json b/composer.json index 31269cb..ee46693 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": "^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3", + "php": "^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3 || ~8.4", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", "psr/http-message": "~1.0 || ~1.1 || ~2.0", diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index e67e0c2..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.11'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; From b4305a817083a43a58affa2502f47fee78602bfb Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Thu, 3 Jul 2025 11:47:02 +0000 Subject: [PATCH 63/68] Release version 3.0.12 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4231563..f8f636e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.12] - 2025-07-03 ### Added - PHP-8.4 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..eb8591a 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.12'; public function smsapiPlService(string $apiToken): SmsapiPlService; From fca4a1ba99f8910975053083033345cfe71d6556 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 12 Jan 2026 10:11:01 +0100 Subject: [PATCH 64/68] Adjust to docker compose CLI API changes. --- build/Makefile | 2 +- build/php-7.0/Makefile | 6 +++--- build/php-7.1/Makefile | 6 +++--- build/php-7.2/Makefile | 6 +++--- build/php-7.3/Makefile | 6 +++--- build/php-7.4/Makefile | 6 +++--- build/php-8.0/Makefile | 6 +++--- build/php-8.1/Makefile | 6 +++--- build/php-8.2/Makefile | 6 +++--- build/php-8.3/Makefile | 6 +++--- build/php-8.4/Makefile | 6 +++--- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/build/Makefile b/build/Makefile index 9c90389..5d807b1 100644 --- a/build/Makefile +++ b/build/Makefile @@ -17,7 +17,7 @@ help: | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' build: ## build php images - docker-compose build + docker compose build test: ## test all against all php images $(MAKE) test-php-7.0 diff --git a/build/php-7.0/Makefile b/build/php-7.0/Makefile index 9f16c05..62c467c 100644 --- a/build/php-7.0/Makefile +++ b/build/php-7.0/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-7.0 test-php-7.0 test-suite-php-7.0 prepare-php-7.0: ## load dependencies with php 7.0 - docker-compose run -T php-7.0 /usr/bin/composer update + docker compose run -T php-7.0 /usr/bin/composer update test-php-7.0: prepare-php-7.0 ## run tests against php 7.0 - docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.0: prepare-php-7.0 ## run suite tests against php 7.0, ex: make test-suite-php-7.0 SUITE="unit" - docker-compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-7.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.1/Makefile b/build/php-7.1/Makefile index b3a33d3..26cbfad 100644 --- a/build/php-7.1/Makefile +++ b/build/php-7.1/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-7.1 test-php-7.1 test-suite-php-7.1 prepare-php-7.1: ## load dependencies with php 7.1 - docker-compose run -T php-7.1 /usr/bin/composer update + docker compose run -T php-7.1 /usr/bin/composer update test-php-7.1: prepare-php-7.1 ## run tests against php 7.1 - docker-compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.1: prepare-php-7.1 ## run suite tests against php 7.1, ex: make test-suite-php-7.1 SUITE="unit" - docker-compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-7.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.2/Makefile b/build/php-7.2/Makefile index 46d4374..6cb0833 100644 --- a/build/php-7.2/Makefile +++ b/build/php-7.2/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-7.2 test-php-7.2 test-suite-php-7.2 prepare-php-7.2: ## load dependencies with php 7.2 - docker-compose run -T php-7.2 /usr/bin/composer update + docker compose run -T php-7.2 /usr/bin/composer update test-php-7.2: prepare-php-7.2 ## run tests against php 7.2 - docker-compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.2: prepare-php-7.2 ## run suite tests against php 7.2, ex: make test-suite-php-7.2 SUITE="unit" - docker-compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-7.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.3/Makefile b/build/php-7.3/Makefile index d866e53..99e7817 100644 --- a/build/php-7.3/Makefile +++ b/build/php-7.3/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-7.3 test-php-7.3 test-suite-php-7.3 prepare-php-7.3: ## load dependencies with php 7.3 - docker-compose run -T php-7.3 /usr/bin/composer update + docker compose run -T php-7.3 /usr/bin/composer update test-php-7.3: prepare-php-7.3 ## run tests against php 7.3 - docker-compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.3: prepare-php-7.3 ## run suite tests against php 7.3, ex: make test-suite-php-7.3 SUITE="unit" - docker-compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-7.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-7.4/Makefile b/build/php-7.4/Makefile index 412c121..d68c343 100644 --- a/build/php-7.4/Makefile +++ b/build/php-7.4/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-7.4 test-php-7.4 test-suite-php-7.4 prepare-php-7.4: ## load dependencies with php 7.4 - docker-compose run -T php-7.4 /usr/bin/composer update + docker compose run -T php-7.4 /usr/bin/composer update test-php-7.4: prepare-php-7.4 ## run tests against php 7.4 - docker-compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-7.4: prepare-php-7.4 ## run suite tests against php 7.4, ex: make test-suite-php-7.4 SUITE="unit" - docker-compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-7.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.0/Makefile b/build/php-8.0/Makefile index e834ead..b8b7eaf 100644 --- a/build/php-8.0/Makefile +++ b/build/php-8.0/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-8.0 test-php-8.0 test-suite-php-8.0 prepare-php-8.0: ## load dependencies with php 8.0 - docker-compose run -T php-8.0 /usr/bin/composer update + docker compose run -T php-8.0 /usr/bin/composer update test-php-8.0: prepare-php-8.0 ## run tests against php 8.0 - docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.0: prepare-php-8.0 ## run suite tests against php 8.0, ex: make test-suite-php-8.0 SUITE="unit" - docker-compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-8.0 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.1/Makefile b/build/php-8.1/Makefile index 517275d..607d37b 100644 --- a/build/php-8.1/Makefile +++ b/build/php-8.1/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-8.1 test-php-8.1 test-suite-php-8.1 prepare-php-8.1: ## load dependencies with php 8.1 - docker-compose run -T php-8.1 /usr/bin/composer update + docker compose run -T php-8.1 /usr/bin/composer update test-php-8.1: prepare-php-8.1 ## run tests against php 8.1 - docker-compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.1: prepare-php-8.1 ## run suite tests against php 8.1, ex: make test-suite-php-8.1 SUITE="unit" - docker-compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-8.1 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.2/Makefile b/build/php-8.2/Makefile index c7788aa..3867be5 100644 --- a/build/php-8.2/Makefile +++ b/build/php-8.2/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-8.2 test-php-8.2 test-suite-php-8.2 prepare-php-8.2: ## load dependencies with php 8.2 - docker-compose run -T php-8.2 /usr/bin/composer update + docker compose run -T php-8.2 /usr/bin/composer update test-php-8.2: prepare-php-8.2 ## run tests against php 8.2 - docker-compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.2: prepare-php-8.2 ## run suite tests against php 8.2, ex: make test-suite-php-8.2 SUITE="unit" - docker-compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-8.2 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.3/Makefile b/build/php-8.3/Makefile index 3b913f1..886f5d4 100644 --- a/build/php-8.3/Makefile +++ b/build/php-8.3/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-8.3 test-php-8.3 test-suite-php-8.3 prepare-php-8.3: ## load dependencies with php 8.3 - docker-compose run -T php-8.3 /usr/bin/composer update + docker compose run -T php-8.3 /usr/bin/composer update test-php-8.3: prepare-php-8.3 ## run tests against php 8.3 - docker-compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.3: prepare-php-8.3 ## run suite tests against php 8.3, ex: make test-suite-php-8.3 SUITE="unit" - docker-compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-8.3 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/build/php-8.4/Makefile b/build/php-8.4/Makefile index 05d45e3..bd4cfd0 100644 --- a/build/php-8.4/Makefile +++ b/build/php-8.4/Makefile @@ -1,10 +1,10 @@ .PHONY: prepare-php-8.4 test-php-8.4 test-suite-php-8.4 prepare-php-8.4: ## load dependencies with php 8.4 - docker-compose run -T php-8.4 /usr/bin/composer update + docker compose run -T php-8.4 /usr/bin/composer update test-php-8.4: prepare-php-8.4 ## run tests against php 8.4 - docker-compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + docker compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml test-suite-php-8.4: prepare-php-8.4 ## run suite tests against php 8.4, ex: make test-suite-php-8.4 SUITE="unit" - docker-compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file + docker compose run -T php-8.4 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file From f656ac6ed137d586ca7744857b13a8965ca33edf Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 12 Jan 2026 10:21:53 +0100 Subject: [PATCH 65/68] Add PHP 8.5 support --- .github/workflows/tests.yml | 1 + CHANGELOG.md | 4 ++++ build/docker-compose.yml | 7 +++++++ build/php-8.5/Dockerfile | 6 ++++++ build/php-8.5/Makefile | 10 ++++++++++ composer.json | 2 +- src/SmsapiClient.php | 2 +- 7 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 build/php-8.5/Dockerfile create mode 100644 build/php-8.5/Makefile diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8abd84f..1657a68 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,6 +27,7 @@ jobs: - 8.2 - 8.3 - 8.4 + - 8.5 steps: - name: Checkout uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index f8f636e..289fc09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Added +- PHP-8.5 support + ## [3.0.12] - 2025-07-03 ### Added - PHP-8.4 support diff --git a/build/docker-compose.yml b/build/docker-compose.yml index d3205f2..dcbfba0 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -70,4 +70,11 @@ services: context: php-8.4 volumes: - ..:/app + network_mode: host + + php-8.5: + build: + context: php-8.5 + volumes: + - ..:/app network_mode: host \ No newline at end of file diff --git a/build/php-8.5/Dockerfile b/build/php-8.5/Dockerfile new file mode 100644 index 0000000..c93d62d --- /dev/null +++ b/build/php-8.5/Dockerfile @@ -0,0 +1,6 @@ +FROM composer:latest AS composer +FROM php:8.5-cli-alpine + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /app/ \ No newline at end of file diff --git a/build/php-8.5/Makefile b/build/php-8.5/Makefile new file mode 100644 index 0000000..3a38702 --- /dev/null +++ b/build/php-8.5/Makefile @@ -0,0 +1,10 @@ +.PHONY: prepare-php-8.5 test-php-8.5 test-suite-php-8.5 + +prepare-php-8.5: ## load dependencies with php 8.5 + docker compose run -T php-8.5 /usr/bin/composer update + +test-php-8.5: prepare-php-8.5 ## run tests against php 8.5 + docker compose run -T php-8.5 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml + +test-suite-php-8.5: prepare-php-8.5 ## run suite tests against php 8.5, ex: make test-suite-php-8.5 SUITE="unit" + docker compose run -T php-8.5 php vendor/bin/phpunit --configuration tests-resources/phpunit.xml --testsuite $(SUITE) \ No newline at end of file diff --git a/composer.json b/composer.json index ee46693..dd8d42e 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } }, "require": { - "php": "^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3 || ~8.4", + "php": "^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3 || ~8.4 || ~8.5", "ext-json": "*", "psr/log": "^1 || ^2 || ^3", "psr/http-message": "~1.0 || ~1.1 || ~2.0", diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index eb8591a..564843f 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = '3.0.12'; + const VERSION = 'Unreleased'; public function smsapiPlService(string $apiToken): SmsapiPlService; From a58a422feb9bd8652dd2893a9a2e5653e8c83764 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Mon, 12 Jan 2026 11:56:43 +0100 Subject: [PATCH 66/68] Release version 3.0.13 --- CHANGELOG.md | 2 +- src/SmsapiClient.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 289fc09..190eb08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [3.0.13] - 2026-01-12 ### Added - PHP-8.5 support diff --git a/src/SmsapiClient.php b/src/SmsapiClient.php index 564843f..1c2bc2b 100644 --- a/src/SmsapiClient.php +++ b/src/SmsapiClient.php @@ -12,7 +12,7 @@ */ interface SmsapiClient extends LoggerAwareInterface { - const VERSION = 'Unreleased'; + const VERSION = '3.0.13'; public function smsapiPlService(string $apiToken): SmsapiPlService; From 394f7b14c788ab36a46ea91f656df51ba569f3d0 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 27 Mar 2026 15:00:14 +0100 Subject: [PATCH 67/68] Remove xdebug from test images. Mitigate pecl installation issues. --- build/php-7.1/Dockerfile | 9 +-------- build/php-7.2/Dockerfile | 9 +-------- build/php-7.3/Dockerfile | 9 +-------- build/php-7.4/Dockerfile | 9 +-------- build/php-8.0/Dockerfile | 9 +-------- build/php-8.1/Dockerfile | 9 +-------- build/php-8.2/Dockerfile | 10 +--------- build/php-8.3/Dockerfile | 10 +--------- build/php-8.4/Dockerfile | 10 +--------- 9 files changed, 9 insertions(+), 75 deletions(-) diff --git a/build/php-7.1/Dockerfile b/build/php-7.1/Dockerfile index 690c835..2a0487e 100644 --- a/build/php-7.1/Dockerfile +++ b/build/php-7.1/Dockerfile @@ -3,14 +3,7 @@ FROM php:7.1-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-2.9.8 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-7.2/Dockerfile b/build/php-7.2/Dockerfile index 0876175..bd7b230 100644 --- a/build/php-7.2/Dockerfile +++ b/build/php-7.2/Dockerfile @@ -3,14 +3,7 @@ FROM php:7.2-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-2.9.8 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-7.3/Dockerfile b/build/php-7.3/Dockerfile index e2dee2e..28ef4fc 100644 --- a/build/php-7.3/Dockerfile +++ b/build/php-7.3/Dockerfile @@ -3,14 +3,7 @@ FROM php:7.3-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-2.9.8 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-7.4/Dockerfile b/build/php-7.4/Dockerfile index 24a17d3..d810922 100644 --- a/build/php-7.4/Dockerfile +++ b/build/php-7.4/Dockerfile @@ -3,14 +3,7 @@ FROM php:7.4-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-2.9.8 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-8.0/Dockerfile b/build/php-8.0/Dockerfile index b75744e..04a6435 100644 --- a/build/php-8.0/Dockerfile +++ b/build/php-8.0/Dockerfile @@ -3,14 +3,7 @@ FROM php:8.0-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-3.1.6 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-8.1/Dockerfile b/build/php-8.1/Dockerfile index a68b5e2..70aea88 100644 --- a/build/php-8.1/Dockerfile +++ b/build/php-8.1/Dockerfile @@ -3,14 +3,7 @@ FROM php:8.1-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make - -RUN pecl install xdebug-3.1.6 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-8.2/Dockerfile b/build/php-8.2/Dockerfile index 9092d51..677d0ad 100644 --- a/build/php-8.2/Dockerfile +++ b/build/php-8.2/Dockerfile @@ -3,15 +3,7 @@ FROM php:8.2-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make \ - linux-headers - -RUN pecl install xdebug-3.2.2 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-8.3/Dockerfile b/build/php-8.3/Dockerfile index 97fdde4..94ac096 100644 --- a/build/php-8.3/Dockerfile +++ b/build/php-8.3/Dockerfile @@ -3,15 +3,7 @@ FROM php:8.3-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make \ - linux-headers - -RUN pecl install xdebug-3.3.1 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer diff --git a/build/php-8.4/Dockerfile b/build/php-8.4/Dockerfile index 30effb1..ba691e0 100644 --- a/build/php-8.4/Dockerfile +++ b/build/php-8.4/Dockerfile @@ -3,15 +3,7 @@ FROM php:8.4-cli-alpine RUN apk update && \ apk upgrade && \ - apk add --no-cache \ - autoconf \ - g++ \ - make \ - linux-headers - -RUN pecl install xdebug-3.4.4 && \ - pecl clear-cache && \ - docker-php-ext-enable xdebug + apk add --no-cache make COPY --from=composer /usr/bin/composer /usr/bin/composer From 740353da4bd89d26adeaca0e7621d688bec073b5 Mon Sep 17 00:00:00 2001 From: Maciej Lew Date: Fri, 27 Mar 2026 15:03:32 +0100 Subject: [PATCH 68/68] Switch to non-blocking dependencies audit. --- .github/workflows/tests.yml | 3 +++ composer.json | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1657a68..9385edd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,5 +49,8 @@ jobs: - name: Install dependencies run: composer update --prefer-dist --no-interaction + - name: Audit dependencies + run: composer audit || true + - name: Running unit tests run: php vendor/bin/phpunit --configuration tests-resources/phpunit.dist.xml --testsuite unit diff --git a/composer.json b/composer.json index dd8d42e..8c5dad5 100644 --- a/composer.json +++ b/composer.json @@ -32,8 +32,7 @@ "phpdocumentor/reflection-docblock": "^4.3 || ^5.2.0", "phpdocumentor/type-resolver": "^0.5 || ^1.3.0", "guzzlehttp/psr7": "^1 || ^2", - "ext-curl": "*", - "roave/security-advisories": "dev-latest" + "ext-curl": "*" }, "suggest": { "ext-curl": "To use Curl HttpClient",