Skip to content

Commit 1dbed2b

Browse files
authored
Merge pull request #36 from railsware/feature/update-php-http-library
Use psr/http-factory instead of php-http/message-factory and small updates
2 parents 730b8f9 + 69d2572 commit 1dbed2b

12 files changed

+24
-86
lines changed

Diff for: .github/workflows/ci-phpunit.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [ ubuntu-latest ]
21-
php-version: [ '8.0','8.1','8.2','8.3' ]
21+
php-version: [ '8.0','8.1','8.2','8.3','8.4' ]
2222

2323
steps:
2424
- name: Checkout
@@ -55,7 +55,7 @@ jobs:
5555
run: composer test
5656

5757
symfony:
58-
name: Symfony ${{ matrix.symfony }} LTS
58+
name: Symfony ${{ matrix.symfony }} LTS and PHP ${{ matrix.php-version }}
5959
runs-on: ubuntu-latest
6060
strategy:
6161
matrix:
@@ -64,6 +64,8 @@ jobs:
6464
php-version: '8.2'
6565
- symfony: '7'
6666
php-version: '8.3'
67+
- symfony: '7'
68+
php-version: '8.4'
6769

6870
steps:
6971
- name: Checkout
@@ -87,7 +89,7 @@ jobs:
8789
run: composer test
8890

8991
laravel:
90-
name: Laravel ${{ matrix.laravel }} LTS
92+
name: Laravel ${{ matrix.laravel }} LTS and PHP ${{ matrix.php-version }}
9193
runs-on: ubuntu-latest
9294
strategy:
9395
matrix:
@@ -98,6 +100,8 @@ jobs:
98100
php-version: '8.2'
99101
- laravel: '11'
100102
php-version: '8.3'
103+
- laravel: '11'
104+
php-version: '8.4'
101105

102106
steps:
103107
- name: Checkout

Diff for: .github/workflows/ci-psalm.yaml

-49
This file was deleted.

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [2.1.0] - 2025-01-28
2+
3+
- Use psr/http-factory instead of php-http/message-factory
4+
- Remove a Psalm library from dependencies which can break installation on PHP 8.4
5+
16
## [2.0.4] - 2025-01-22
27

38
- Add name prefix into custom EmailHeaders to avoid conflicts with reserved names Symfony\Component\Mime\Header\Headers::HEADER_CLASS_MAP

Diff for: README.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Official Mailtrap PHP client
22
===============
33
![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-phpunit.yml/badge.svg)
4-
![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-psalm.yaml/badge.svg)
54

65
[![PHP version support](https://img.shields.io/packagist/dependency-v/railsware/mailtrap-php/php?style=flat)](https://packagist.org/packages/railsware/mailtrap-php)
76
[![Latest Version on Packagist](https://img.shields.io/packagist/v/railsware/mailtrap-php.svg?style=flat)](https://packagist.org/packages/railsware/mailtrap-php)

Diff for: composer.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
"php-http/client-common": "^2.0",
1414
"php-http/httplug": "^2.0",
1515
"php-http/discovery": "^1.0",
16-
"php-http/message-factory": "^1.0",
1716
"symfony/mime": "^6.0|^7.0",
18-
"egulias/email-validator": "^2.1.10|^3.1|^4"
17+
"egulias/email-validator": "^2.1.10|^3.1|^4",
18+
"psr/http-factory": "^1.1"
1919
},
2020
"require-dev": {
2121
"symfony/http-client": "^6.0|^7.0",
2222
"symfony/mailer": "^6.0|^7.0",
2323
"phpunit/phpunit": "^9",
24-
"nyholm/psr7": "^1.5",
25-
"vimeo/psalm": "^5.0"
24+
"nyholm/psr7": "^1.5"
2625
},
2726
"suggest": {
2827
"nyholm/psr7": "PSR-7 message implementation",

Diff for: phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
verbose="true"
1818
>
1919
<php>
20-
<ini name="error_reporting" value="-1" />
20+
<ini name="error_reporting" value="E_ALL &amp; ~E_DEPRECATED" />
2121
</php>
2222

2323
<testsuites>

Diff for: psalm.xml

-20
This file was deleted.

Diff for: src/Api/AbstractApi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function handleResponse(ResponseInterface $response): ResponseInterfac
117117
*
118118
* @return string
119119
*/
120-
private function jsonEncode(mixed $value, int $flags = null, int $maxDepth = 512): string
120+
private function jsonEncode(mixed $value, ?int $flags = null, int $maxDepth = 512): string
121121
{
122122
$flags ??= \JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION;
123123

Diff for: src/Api/Sandbox/Attachment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
*/
3232
public function getMessageAttachments(
3333
int $messageId,
34-
string $attachmentType = null
34+
?string $attachmentType = null
3535
): ResponseInterface {
3636
$parameters = [];
3737
if (!empty($attachmentType)) {

Diff for: src/Bridge/Transport/MailtrapApiTransport.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class MailtrapApiTransport extends AbstractTransport
2626
public function __construct(
2727
private EmailsSendApiInterface $emailsSendApiLayer,
2828
private Config $config,
29-
EventDispatcherInterface $dispatcher = null,
30-
LoggerInterface $logger = null
29+
?EventDispatcherInterface $dispatcher = null,
30+
?LoggerInterface $logger = null
3131
) {
3232
parent::__construct($dispatcher, $logger);
3333
}

Diff for: src/HttpClient/HttpClientBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class HttpClientBuilder implements HttpClientBuilderInterface
2727

2828
public function __construct(
2929
private string $apiToken,
30-
ClientInterface $httpClient = null,
31-
RequestFactoryInterface $requestFactory = null,
32-
StreamFactoryInterface $streamFactory = null
30+
?ClientInterface $httpClient = null,
31+
?RequestFactoryInterface $requestFactory = null,
32+
?StreamFactoryInterface $streamFactory = null
3333
) {
3434
$this->httpClient = $httpClient ?? Psr18ClientDiscovery::find();
3535
$this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory();

Diff for: src/MailtrapClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function initSendingEmails(
3535
string $apiKey,
3636
bool $isBulk = false,
3737
bool $isSandbox = false,
38-
int $inboxId = null,
38+
?int $inboxId = null,
3939
): EmailsSendApiInterface {
4040
$client = new self(new Config($apiKey));
4141

0 commit comments

Comments
 (0)