Skip to content

Commit

Permalink
Merge pull request #36 from railsware/feature/update-php-http-library
Browse files Browse the repository at this point in the history
Use psr/http-factory instead of php-http/message-factory and small updates
  • Loading branch information
gaalferov authored Jan 27, 2025
2 parents 730b8f9 + 69d2572 commit 1dbed2b
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 86 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -64,6 +64,8 @@ jobs:
php-version: '8.2'
- symfony: '7'
php-version: '8.3'
- symfony: '7'
php-version: '8.4'

steps:
- name: Checkout
Expand All @@ -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:
Expand All @@ -98,6 +100,8 @@ jobs:
php-version: '8.2'
- laravel: '11'
php-version: '8.3'
- laravel: '11'
php-version: '8.4'

steps:
- name: Checkout
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/ci-psalm.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Official Mailtrap PHP client
===============
![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-phpunit.yml/badge.svg)
![GitHub Actions](https://github.com/railsware/mailtrap-php/actions/workflows/ci-psalm.yaml/badge.svg)

[![PHP version support](https://img.shields.io/packagist/dependency-v/railsware/mailtrap-php/php?style=flat)](https://packagist.org/packages/railsware/mailtrap-php)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/railsware/mailtrap-php.svg?style=flat)](https://packagist.org/packages/railsware/mailtrap-php)
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
verbose="true"
>
<php>
<ini name="error_reporting" value="-1" />
<ini name="error_reporting" value="E_ALL &amp; ~E_DEPRECATED" />
</php>

<testsuites>
Expand Down
20 changes: 0 additions & 20 deletions psalm.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Api/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Api/Sandbox/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
*/
public function getMessageAttachments(
int $messageId,
string $attachmentType = null
?string $attachmentType = null
): ResponseInterface {
$parameters = [];
if (!empty($attachmentType)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Transport/MailtrapApiTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/HttpClient/HttpClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/MailtrapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 1dbed2b

Please sign in to comment.