From 201ff898faaad07971cf9db5a7c4b37a87f43bb0 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Mon, 7 Feb 2022 15:50:25 -0600 Subject: [PATCH 01/10] chore: upgrade supported language versions --- .github/workflows/test-and-deploy.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 885e115..83d9cfe 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - php: [ 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 ] + php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ] dependencies: - "lowest" - "highest" @@ -56,7 +56,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@2.15.0 with: - php-version: '7.4' + php-version: '8.1' id: php - name: Build Release Artifacts diff --git a/README.md b/README.md index c5ff5cd..6f14807 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ All updates to this library are documented in our [CHANGELOG](CHANGELOG.md). ## Prerequisites -- PHP version 5.6, 7.0, 7.1, 7.2, 7.3, or 7.4 +- PHP version 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, or 8.1 ## Install with Composer From fee9267e4dd17122a56b7094c9c89e540daf66f9 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 9 Feb 2022 14:49:26 -0800 Subject: [PATCH 02/10] [Librarian] Version Bump --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 065f838..4da35e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +[2022-02-09] Version 3.14.3 +--------------------------- +**Library - Chore** +- [PR #151](https://github.com/sendgrid/php-http-client/pull/151): add deploy steps to build library release artifacts. Thanks to [@Hunga1](https://github.com/Hunga1)! +- [PR #150](https://github.com/sendgrid/php-http-client/pull/150): add gh release to workflow. Thanks to [@shwetha-manvinkurke](https://github.com/shwetha-manvinkurke)! + + [2022-01-26] Version 3.14.2 --------------------------- **Library - Chore** From f9b24695fec076f21b487543c47b8e1370498472 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 9 Feb 2022 14:49:27 -0800 Subject: [PATCH 03/10] Release 3.14.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f14807..fd86d83 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer ```json { "require": { - "sendgrid/php-http-client": "^3.14.2" + "sendgrid/php-http-client": "^3.14.3" } } ``` From 8449e26c8e958f31d095aa3b481510ebb220744f Mon Sep 17 00:00:00 2001 From: Elise Shanholtz Date: Mon, 28 Feb 2022 12:41:39 -0800 Subject: [PATCH 04/10] chore: push Datadog Release Metric upon deploy success (#152) --- .github/workflows/test-and-deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 83d9cfe..268d011 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -69,6 +69,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Submit metric to Datadog + uses: sendgrid/dx-automator/actions/datadog-release-metric@main + env: + DD_API_KEY: ${{ secrets.DATADOG_API_KEY }} + notify-on-failure: name: Slack notify on failure if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag') From 64cac7eb3524ac5ad31b9afe2cf16eaae201c460 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 9 Mar 2022 12:21:54 -0800 Subject: [PATCH 05/10] [Librarian] Version Bump --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da35e3..25f9eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +[2022-03-09] Version 3.14.4 +--------------------------- +**Library - Chore** +- [PR #152](https://github.com/sendgrid/php-http-client/pull/152): push Datadog Release Metric upon deploy success. Thanks to [@eshanholtz](https://github.com/eshanholtz)! + + [2022-02-09] Version 3.14.3 --------------------------- **Library - Chore** From 9e54653520cba25f08a58c94e3be9f8488f8f637 Mon Sep 17 00:00:00 2001 From: Twilio Date: Wed, 9 Mar 2022 12:21:55 -0800 Subject: [PATCH 06/10] Release 3.14.4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd86d83..c1dcd74 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Add php-http-client to your `composer.json` file. If you are not using [Composer ```json { "require": { - "sendgrid/php-http-client": "^3.14.3" + "sendgrid/php-http-client": "^3.14.4" } } ``` From 8c237b4c8191659c68b30bbcb6d5ae99dbfbf4e2 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Thu, 24 Mar 2022 10:48:10 -0500 Subject: [PATCH 07/10] chore: remove outdated announcements --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c1dcd74..48119dd 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ If you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-php). # Announcements -**The default branch name for this repository has been changed to `main` as of 07/27/2020.** - All updates to this library are documented in our [CHANGELOG](CHANGELOG.md). # Table of Contents From 85cde11caa1d187ac07fb0d80b0f0f3142cbcbfa Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Fri, 25 Mar 2022 13:39:50 -0500 Subject: [PATCH 08/10] feat: add PR title validation --- .github/workflows/pr-lint.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/pr-lint.yml diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..8388f21 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,15 @@ +name: Lint PR +on: + pull_request_target: + types: [ opened, edited, reopened ] + +jobs: + validate: + name: Validate title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v4 + with: + types: chore docs fix feat test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From da3df945c2059765c344c67277df6776f6e846c5 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Tue, 12 Apr 2022 15:40:21 -0500 Subject: [PATCH 09/10] drop support for EOL PHP versions and upgrade phpunit --- .github/workflows/test-and-deploy.yml | 2 +- CONTRIBUTING.md | 2 +- Makefile | 2 +- README.md | 2 +- UPGRADE.md | 8 +++++ composer.json | 5 ++- test/unit/ClientTest.php | 46 +++++++++++++-------------- test/unit/MockClient.php | 6 ++-- test/unit/ResponseTest.php | 14 ++++---- 9 files changed, 46 insertions(+), 41 deletions(-) create mode 100644 UPGRADE.md diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 268d011..1f903e5 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ] + php: [ '7.3', '7.4', '8.0', '8.1' ] dependencies: - "lowest" - "highest" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d1425b..c587736 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ We welcome direct contributions to the php-http-client code base. Thank you! ##### Prerequisites ##### -- PHP 5.6 or 7.0 +- PHP version 7.3, 7.4, 8.0, or 8.1 - [Composer](https://getcomposer.org/) ##### Initial setup: ##### diff --git a/Makefile b/Makefile index f14433b..db07641 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ ci-install: clean composer install --no-dev install: clean - composer install --no-suggest --no-scripts --no-progress --no-interaction + composer install --no-scripts --no-progress --no-interaction test: install vendor/bin/phpunit test/unit diff --git a/README.md b/README.md index 48119dd..e86f3a4 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ All updates to this library are documented in our [CHANGELOG](CHANGELOG.md). ## Prerequisites -- PHP version 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, or 8.1 +- PHP version 7.3, 7.4, 8.0, or 8.1 ## Install with Composer diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..eb3b944 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,8 @@ +# Upgrade Guide + +_MAJOR version bumps will have upgrade notes posted here._ + +[2022-05-04] 3.x.x to 4.x.x +--------------------------- + +### CHANGED - Drop support for PHP versions 5.6, 7.0, 7.1, and 7.2 which are EOL. diff --git a/composer.json b/composer.json index 0c637fa..2d0ead0 100644 --- a/composer.json +++ b/composer.json @@ -16,14 +16,13 @@ } ], "require": { - "php": ">=5.6", + "php": ">=7.3", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.5", - "sebastian/version": "^1.0.6", + "phpunit/phpunit": "^9", "squizlabs/php_codesniffer": "~2.0", "friendsofphp/php-cs-fixer": "^2.16" }, diff --git a/test/unit/ClientTest.php b/test/unit/ClientTest.php index 41f2ca8..cfea449 100644 --- a/test/unit/ClientTest.php +++ b/test/unit/ClientTest.php @@ -15,7 +15,7 @@ class ClientTest extends TestCase /** @var array */ private $headers; - protected function setUp() + protected function setUp(): void { $this->host = 'https://localhost:4010'; $this->headers = [ @@ -27,13 +27,11 @@ protected function setUp() public function testConstructor() { - $this->assertAttributeEquals($this->host, 'host', $this->client); - $this->assertAttributeEquals($this->headers, 'headers', $this->client); - $this->assertAttributeEquals('/v3', 'version', $this->client); - $this->assertAttributeEquals([], 'path', $this->client); - $this->assertAttributeEquals([], 'curlOptions', $this->client); - $this->assertAttributeEquals(false, 'retryOnLimit', $this->client); - $this->assertAttributeEquals(['get', 'post', 'patch', 'put', 'delete'], 'methods', $this->client); + $this->assertEquals($this->host, $this->client->getHost()); + $this->assertEquals($this->headers, $this->client->getHeaders()); + $this->assertEquals('/v3', $this->client->getVersion()); + $this->assertEquals([], $this->client->getPath()); + $this->assertEquals([], $this->client->getCurlOptions()); } public function test_() @@ -42,34 +40,34 @@ public function test_() $client->setCurlOptions(['foo' => 'bar']); $client = $client->_('test'); - $this->assertAttributeEquals(['test'], 'path', $client); - $this->assertAttributeEquals(['foo' => 'bar'], 'curlOptions', $client); + $this->assertEquals(['test'], $client->getPath()); + $this->assertEquals(['foo' => 'bar'], $client->getCurlOptions()); } public function test__call() { $client = $this->client->get(); - $this->assertAttributeEquals('https://localhost:4010/v3/', 'url', $client); + $this->assertEquals('https://localhost:4010/v3/', $client->url); $queryParams = ['limit' => 100, 'offset' => 0]; $client = $this->client->get(null, $queryParams); - $this->assertAttributeEquals('https://localhost:4010/v3/?limit=100&offset=0', 'url', $client); + $this->assertEquals('https://localhost:4010/v3/?limit=100&offset=0', $client->url); $requestBody = ['name' => 'A New Hope']; $client = $this->client->get($requestBody); - $this->assertAttributeEquals($requestBody, 'requestBody', $client); + $this->assertEquals($requestBody, $client->requestBody); $requestHeaders = ['X-Mock: 200']; $client = $this->client->get(null, null, $requestHeaders); - $this->assertAttributeEquals($requestHeaders, 'requestHeaders', $client); + $this->assertEquals($requestHeaders, $client->requestHeaders); $client = $this->client->version('/v4'); - $this->assertAttributeEquals('/v4', 'version', $client); + $this->assertEquals('/v4', $client->getVersion()); $client = $this->client->path_to_endpoint(); - $this->assertAttributeEquals(['path_to_endpoint'], 'path', $client); + $this->assertEquals(['path_to_endpoint'], $client->getPath()); $client = $client->one_more_segment(); - $this->assertAttributeEquals(['path_to_endpoint', 'one_more_segment'], 'path', $client); + $this->assertEquals(['path_to_endpoint', 'one_more_segment'], $client->getPath()); } public function testGetHost() @@ -212,7 +210,7 @@ public function testThrowExceptionOnInvalidCall() public function testMakeRequestWithUntrustedRootCert() { $this->expectException(InvalidRequest::class); - $this->expectExceptionMessageRegExp('/certificate/i'); + $this->expectExceptionMessageMatches('/certificate/i'); $client = new Client('https://untrusted-root.badssl.com/'); $client->makeRequest('GET', 'https://untrusted-root.badssl.com/'); @@ -223,12 +221,12 @@ public function testFormRepeatUrlArgs() $client = new Client('https://localhost:4010'); $testParams = [ - 'thing' => 'stuff', - 'foo' => [ - 'bar', - 'bat', - 'baz', - ], + 'thing' => 'stuff', + 'foo' => [ + 'bar', + 'bat', + 'baz', + ], ]; $result = $this->callMethod($client, 'buildUrl', [$testParams]); $this->assertEquals($result, 'https://localhost:4010/?thing=stuff&foo=bar&foo=bat&foo=baz'); diff --git a/test/unit/MockClient.php b/test/unit/MockClient.php index ae7ed79..b1c897a 100644 --- a/test/unit/MockClient.php +++ b/test/unit/MockClient.php @@ -6,9 +6,9 @@ class MockClient extends Client { - protected $requestBody; - protected $requestHeaders; - protected $url; + public $requestBody; + public $requestHeaders; + public $url; public function makeRequest($method, $url, $requestBody = null, $requestHeaders = null, $retryOnLimit = false) { diff --git a/test/unit/ResponseTest.php b/test/unit/ResponseTest.php index 3366ec6..9f83b89 100644 --- a/test/unit/ResponseTest.php +++ b/test/unit/ResponseTest.php @@ -2,8 +2,8 @@ namespace SendGrid\Test; -use SendGrid\Response; use PHPUnit\Framework\TestCase; +use SendGrid\Response; class ResponseTest extends TestCase { @@ -11,15 +11,15 @@ public function testConstructor() { $response = new Response(); - $this->assertAttributeEquals(200, 'statusCode', $response); - $this->assertAttributeEquals('', 'body', $response); - $this->assertAttributeEquals([], 'headers', $response); + $this->assertEquals(200, $response->statusCode()); + $this->assertEquals('', $response->body()); + $this->assertEquals([], $response->headers()); $response = new Response(201, 'test', ['Content-Encoding: gzip']); - $this->assertAttributeEquals(201, 'statusCode', $response); - $this->assertAttributeEquals('test', 'body', $response); - $this->assertAttributeEquals(['Content-Encoding: gzip'], 'headers', $response); + $this->assertEquals(201, $response->statusCode()); + $this->assertEquals('test', $response->body()); + $this->assertEquals(['Content-Encoding: gzip'], $response->headers()); } public function testStatusCode() From a741cd4604f7ec7b43d65b4ebbd6c559e27db4d2 Mon Sep 17 00:00:00 2001 From: Sam Harrison Date: Tue, 12 Apr 2022 15:53:50 -0500 Subject: [PATCH 10/10] update Dockerfile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index da1ef10..2261ad9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.1-apache +FROM php:8.1 ARG sendgrid_apikey ENV SENDGRID_API_KEY=$sendgrid_apikey @@ -7,7 +7,8 @@ COPY . /var/www/client WORKDIR /var/www/client RUN apt-get update && \ - apt-get install -y git zip zlib1g-dev && docker-php-ext-install zip + apt-get install -y git libzip-dev && \ + docker-php-ext-install zip RUN curl --silent --show-error https://getcomposer.org/installer | php RUN php composer.phar install