diff --git a/.github/workflows/ci-phpunit.yml b/.github/workflows/ci-phpunit.yml
index dec4fc1..e2d2b0e 100644
--- a/.github/workflows/ci-phpunit.yml
+++ b/.github/workflows/ci-phpunit.yml
@@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
- php-version: [ '8.0','8.1','8.2','8.3' ]
+ php-version: [ '8.0','8.1','8.2','8.3','8.4' ]
steps:
- name: Checkout
@@ -55,7 +55,7 @@ jobs:
run: composer test
symfony:
- name: Symfony ${{ matrix.symfony }} LTS
+ name: Symfony ${{ matrix.symfony }} LTS and PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
matrix:
@@ -64,6 +64,8 @@ jobs:
php-version: '8.2'
- symfony: '7'
php-version: '8.3'
+ - symfony: '7'
+ php-version: '8.4'
steps:
- name: Checkout
@@ -87,7 +89,7 @@ jobs:
run: composer test
laravel:
- name: Laravel ${{ matrix.laravel }} LTS
+ name: Laravel ${{ matrix.laravel }} LTS and PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
matrix:
@@ -98,6 +100,8 @@ jobs:
php-version: '8.2'
- laravel: '11'
php-version: '8.3'
+ - laravel: '11'
+ php-version: '8.4'
steps:
- name: Checkout
diff --git a/.github/workflows/ci-psalm.yaml b/.github/workflows/ci-psalm.yaml
deleted file mode 100644
index e3faa58..0000000
--- a/.github/workflows/ci-psalm.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Psalm Analyze
-
-on:
- push:
- branches: [ main ]
- pull_request:
- branches:
- - 'release/**'
- - 'feature/**'
- - 'main'
-
-jobs:
- psalm-analyze:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ ubuntu-latest ]
- php-versions: [ '8.0','8.1','8.2','8.3' ]
-
- steps:
- - name: Checkout
- uses: actions/checkout@v3
-
- - name: Setup PHP
- id: setup-php
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, intl, curl
-
- - name: Print PHP version
- run: echo ${{ steps.setup-php.outputs.php-version }}
-
- - name: Get composer cache directory
- id: composer-cache
- run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
-
- - name: Cache dependencies
- uses: actions/cache@v3
- with:
- path: ${{ steps.composer-cache.outputs.dir }}
- key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- restore-keys: ${{ runner.os }}-composer
-
- - name: Install Composer dependencies
- run: composer install --prefer-dist --no-progress
-
- - name: Run Psalm analyze
- run: vendor/bin/psalm
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a0f6b5..07be92b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## [2.1.0] - 2025-01-28
+
+- Use psr/http-factory instead of php-http/message-factory
+- Remove a Psalm library from dependencies which can break installation on PHP 8.4
+
## [2.0.4] - 2025-01-22
- Add name prefix into custom EmailHeaders to avoid conflicts with reserved names Symfony\Component\Mime\Header\Headers::HEADER_CLASS_MAP
diff --git a/README.md b/README.md
index 11a77fa..756ace1 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
Official Mailtrap PHP client
===============

-
[](https://packagist.org/packages/railsware/mailtrap-php)
[](https://packagist.org/packages/railsware/mailtrap-php)
diff --git a/composer.json b/composer.json
index 42192a0..85a2a4b 100644
--- a/composer.json
+++ b/composer.json
@@ -13,16 +13,15 @@
"php-http/client-common": "^2.0",
"php-http/httplug": "^2.0",
"php-http/discovery": "^1.0",
- "php-http/message-factory": "^1.0",
"symfony/mime": "^6.0|^7.0",
- "egulias/email-validator": "^2.1.10|^3.1|^4"
+ "egulias/email-validator": "^2.1.10|^3.1|^4",
+ "psr/http-factory": "^1.1"
},
"require-dev": {
"symfony/http-client": "^6.0|^7.0",
"symfony/mailer": "^6.0|^7.0",
"phpunit/phpunit": "^9",
- "nyholm/psr7": "^1.5",
- "vimeo/psalm": "^5.0"
+ "nyholm/psr7": "^1.5"
},
"suggest": {
"nyholm/psr7": "PSR-7 message implementation",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 3a58bdb..854c641 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -17,7 +17,7 @@
verbose="true"
>
-
+
diff --git a/psalm.xml b/psalm.xml
deleted file mode 100644
index 0cc97c2..0000000
--- a/psalm.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Api/AbstractApi.php b/src/Api/AbstractApi.php
index 98842aa..893c1a7 100644
--- a/src/Api/AbstractApi.php
+++ b/src/Api/AbstractApi.php
@@ -117,7 +117,7 @@ protected function handleResponse(ResponseInterface $response): ResponseInterfac
*
* @return string
*/
- private function jsonEncode(mixed $value, int $flags = null, int $maxDepth = 512): string
+ private function jsonEncode(mixed $value, ?int $flags = null, int $maxDepth = 512): string
{
$flags ??= \JSON_HEX_TAG | \JSON_HEX_APOS | \JSON_HEX_AMP | \JSON_HEX_QUOT | \JSON_PRESERVE_ZERO_FRACTION;
diff --git a/src/Api/Sandbox/Attachment.php b/src/Api/Sandbox/Attachment.php
index 7297413..574dcf7 100644
--- a/src/Api/Sandbox/Attachment.php
+++ b/src/Api/Sandbox/Attachment.php
@@ -31,7 +31,7 @@ public function __construct(
*/
public function getMessageAttachments(
int $messageId,
- string $attachmentType = null
+ ?string $attachmentType = null
): ResponseInterface {
$parameters = [];
if (!empty($attachmentType)) {
diff --git a/src/Bridge/Transport/MailtrapApiTransport.php b/src/Bridge/Transport/MailtrapApiTransport.php
index eb1d76e..5e40019 100644
--- a/src/Bridge/Transport/MailtrapApiTransport.php
+++ b/src/Bridge/Transport/MailtrapApiTransport.php
@@ -26,8 +26,8 @@ class MailtrapApiTransport extends AbstractTransport
public function __construct(
private EmailsSendApiInterface $emailsSendApiLayer,
private Config $config,
- EventDispatcherInterface $dispatcher = null,
- LoggerInterface $logger = null
+ ?EventDispatcherInterface $dispatcher = null,
+ ?LoggerInterface $logger = null
) {
parent::__construct($dispatcher, $logger);
}
diff --git a/src/HttpClient/HttpClientBuilder.php b/src/HttpClient/HttpClientBuilder.php
index 7538a4b..4a5a2c4 100644
--- a/src/HttpClient/HttpClientBuilder.php
+++ b/src/HttpClient/HttpClientBuilder.php
@@ -27,9 +27,9 @@ class HttpClientBuilder implements HttpClientBuilderInterface
public function __construct(
private string $apiToken,
- ClientInterface $httpClient = null,
- RequestFactoryInterface $requestFactory = null,
- StreamFactoryInterface $streamFactory = null
+ ?ClientInterface $httpClient = null,
+ ?RequestFactoryInterface $requestFactory = null,
+ ?StreamFactoryInterface $streamFactory = null
) {
$this->httpClient = $httpClient ?? Psr18ClientDiscovery::find();
$this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory();
diff --git a/src/MailtrapClient.php b/src/MailtrapClient.php
index 3274da4..e2f70a0 100644
--- a/src/MailtrapClient.php
+++ b/src/MailtrapClient.php
@@ -35,7 +35,7 @@ public static function initSendingEmails(
string $apiKey,
bool $isBulk = false,
bool $isSandbox = false,
- int $inboxId = null,
+ ?int $inboxId = null,
): EmailsSendApiInterface {
$client = new self(new Config($apiKey));