Skip to content

Commit f9bcf45

Browse files
authored
Merge pull request #103 from dotkernel/issue-100
Issue #100: Remove PHP 8.1 and add PHP 8.4 & 8.5 support
2 parents 83c0084 + 157aadd commit f9bcf45

25 files changed

Lines changed: 201 additions & 123 deletions

.github/workflows/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
php:
1818
- "8.2"
1919
- "8.3"
20+
- "8.4"
21+
- "8.5"
2022

2123
steps:
2224
- name: Checkout
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on:
2+
- push
3+
4+
name: Run PHPStan checks
5+
6+
jobs:
7+
mutation:
8+
name: PHPStan ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.2"
19+
- "8.3"
20+
- "8.4"
21+
- "8.5"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Install PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
coverage: pcov
32+
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
33+
tools: composer:v2, cs2pr
34+
35+
- name: Determine composer cache directory
36+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
37+
38+
- name: Cache dependencies installed with composer
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.COMPOSER_CACHE_DIR }}
42+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
43+
restore-keys: |
44+
php${{ matrix.php }}-composer-
45+
46+
- name: Install dependencies with composer
47+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
48+
49+
- name: Run static analysis with PHPStan
50+
run: vendor/bin/phpstan analyse

.laminas-ci.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
{
2-
"ignore_php_platform_requirements": {
3-
"8.4": true
4-
},
5-
"backwardCompatibilityCheck": true
6-
}
1+
{
2+
"backwardCompatibilityCheck": true
3+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# dot-mail
22

3-
> [!IMPORTANT]
43
> dot-mail is a wrapper on top of [symfony mailer](https://github.com/symfony/mailer)
54
6-
## dot-mail badges
5+
## Badges
76

87
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-mail)
9-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.1.3)
8+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.1.6)
109

1110
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/issues)
1211
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/network)
@@ -15,6 +14,7 @@
1514

1615
[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.1)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml)
1716
[![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/5.0/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail)
17+
[![PHPStan](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=5.1)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml)
1818

1919
## Installation
2020

SECURITY.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,29 @@
22

33
## Supported Versions
44

5-
65
| Version | Supported | PHP Version |
76
|---------|--------------------|----------------------------------------------------------------------------------------------------------|
8-
| 5.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.0.0) |
7+
| 5.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.1.6) |
98
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.3.0) |
109
| <= 3.x | :x: | |
1110

12-
1311
## Reporting Potential Security Issues
1412

15-
If you have encountered a potential security vulnerability in this project,
16-
please report it to us at <security@dotkernel.com>. We will work with you to
17-
verify the vulnerability and patch it.
13+
If you have encountered a potential security vulnerability in this project, please report it to us at <security@dotkernel.com>.
14+
We will work with you to verify the vulnerability and patch it.
1815

1916
When reporting issues, please provide the following information:
2017

2118
- Component(s) affected
2219
- A description indicating how to reproduce the issue
2320
- A summary of the security vulnerability and impact
2421

25-
We request that you contact us via the email address above and give the
26-
project contributors a chance to resolve the vulnerability and issue a new
27-
release prior to any public exposure; this helps protect the project's
28-
users, and provides them with a chance to upgrade and/or update in order to
29-
protect their applications.
30-
22+
We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure;
23+
this helps protect the project's users and provides them with a chance to upgrade and/or update to protect their applications.
3124

3225
## Policy
3326

3427
If we verify a reported security vulnerability, our policy is:
3528

36-
- We will patch the current release branch, as well as the immediate prior minor
37-
release branch.
38-
39-
- After patching the release branches, we will immediately issue new security
40-
fix releases for each patched release branch.
29+
- We will patch the current release branch, as well as the immediate prior minor release branch.
30+
- After patching the release branches, we will immediately issue new security fix releases for each patched release branch.

composer.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@
2727
}
2828
},
2929
"require": {
30-
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
30+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
3131
"ext-fileinfo": "*",
3232
"ext-json": "*",
33-
"laminas/laminas-servicemanager": "^3.22",
3433
"dotkernel/dot-event": "^3.4",
34+
"laminas/laminas-servicemanager": "^3.22",
3535
"symfony/mailer": "^v7.1.6"
3636
},
3737
"require-dev": {
38-
"laminas/laminas-coding-standard": "^3.0",
3938
"mikey179/vfsstream": "^v1.6.11",
40-
"phpunit/phpunit": "^10.5",
41-
"vimeo/psalm": "^5.23"
39+
"laminas/laminas-coding-standard": "^3.0",
40+
"phpstan/phpstan": "^2.1",
41+
"phpstan/phpstan-phpunit": "^2.0",
42+
"phpunit/phpunit": "^10.5"
4243
},
4344
"autoload": {
4445
"psr-4": {
@@ -53,12 +54,12 @@
5354
"scripts": {
5455
"check": [
5556
"@cs-check",
56-
"@test"
57+
"@test",
58+
"@static-analysis"
5759
],
5860
"cs-check": "phpcs",
5961
"cs-fix": "phpcbf",
60-
"test": "phpunit --colors=always",
61-
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
62-
"static-analysis": "psalm --shepherd --stats"
62+
"static-analysis": "phpstan analyse --memory-limit 1G",
63+
"test": "phpunit --colors=always"
6364
}
6465
}

docs/book/v4/configuration.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Register `dot-mail` in you project by adding `Dot\Mail\ConfigProvider::class` to your configuration aggregator (to `config/config.php` for example).
44
After registering the `ConfigProvider` copy the configuration file `config/mail.global.php.dist` into your project's `config/autoload/` directory as `mail.global.php`.
55

6-
The resulting `mail.global.php` contains the necessary configurations for all available transport types, message options and logging options in one place. The config file provides a set of default values available to all mails under the `dot-mail.default` key.
6+
The resulting `mail.global.php` contains the necessary configurations for all available transport types, message options and logging options in one place.
7+
The config file provides a set of default values available to all mails under the `dot-mail.default` key.
78

89
Many of these options can be programmatically set when sending the actual email.
910

@@ -49,11 +50,9 @@ Using `Laminas\Mail\Transport\File` as the transport will require uncommenting t
4950
## Logging configuration
5051

5152
Uncommenting the `dot-mail.log` key will save a copy of all sent emails' subject, recipient addresses, cc and bcc addresses alongside a timestamp.
52-
In order to enable it, make sure that your `mail.local.php` has the below `log` configuration under the `dot_mail` key:
53+
To enable it, make sure that your `mail.local.php` has the below `log` configuration under the `dot_mail` key:
5354

5455
```php
55-
<?php
56-
5756
return [
5857
'dot_mail' => [
5958
...

docs/book/v4/overview.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
> dot-mail is a wrapper on top of [laminas-mail](https://github.com/laminas/laminas-mail)
44
5+
## Badges
6+
7+
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-mail)
8+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.3.0)
9+
10+
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/issues)
11+
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/network)
12+
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers)
13+
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/4.0/LICENSE.md)
14+
15+
[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml)
16+
[![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/4.0/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail)
17+
518
## Extra features
619

7-
- the option to log the results of the mailing process it provides the developer with more information and greater control.
20+
The option to log the results of the mailing process it provides the developer with more information and greater control.

docs/book/v4/transports.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@
99

1010
> Feel free to use any custom transport you desire, provided it implements the mentioned `TransportInterface`.
1111
12-
`Sendmail` is a wrapper over PHP's `mail()` function, and as such has a different behaviour on Windows than on *nix systems. Using sendmail on Windows **will not work in combination with** `addBcc()`.
12+
`Sendmail` is a wrapper over PHP's `mail()` function, and as such has a different behavior on Windows than on *nix systems. Using sendmail on Windows **will not work in combination with** `addBcc()`.
1313

1414
- Note: emails sent using the sendmail transport will be more often delivered to SPAM.
1515

16-
`Smtp` connects to the configured SMTP host in order to handle sending emails. Saving a copy of an outgoing mail into a folder is possible for this transport only, and is done by uncommenting `save_sent_message_folder` in the config file `mail.local.php` under `dot_mail.default`.
16+
`Smtp` connects to the configured SMTP host to handle sending emails.
17+
Saving a copy of outgoing mail into a folder is possible for this transport only, and is done by uncommenting `save_sent_message_folder` in the config file `mail.local.php` under `dot_mail.default`.
1718

18-
- Common folder names are `INBOX`, `INBOX.Archive`, `INBOX.Drafts`, `INBOX.Sent`, `INBOX.Spam`, `INBOX.Trash`. If you have `MailService` available in your class, you can call `$this->mailService->getFolderGlobalNames()` to list the folder global names for the email you are using.
19+
- Common folder names are `INBOX`, `INBOX.Archive`, `INBOX.Drafts`, `INBOX.Sent`, `INBOX.Spam`, `INBOX.Trash`.
20+
If you have `MailService` available in your class, you can call `$this->mailService->getFolderGlobalNames()` to list the folder global names for the email you are using.
1921
- Multiple folders can be added to the `save_sent_message_folder` key to save a copy of the outgoing email in each folder.
2022

21-
`File` writes each message individually in a file named after the configured format, placed in the configured directory. From here the files may be used for sending via another transport mechanism, or simply as logs.
23+
`File` writes each message individually in a file named after the configured format, placed in the configured directory.
24+
From here the files may be used for sending via another transport mechanism, or simply as logs.
2225

2326
`InMemory` saves the message in memory, allowing access to the last "sent" message via the `getLastMessage()` function.
2427

25-
- As the email is not sent, this transport can be helpful in development, with the access to the message being potentially useful in tests as well
28+
- As the email is not sent, this transport can be helpful in development, with the access to the message being potentially useful in tests as well.
2629

2730
```php
2831
$this->mailService->setBody('First email body');

docs/book/v4/usage.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
## Sending an e-mail
44

5-
Below is an example of how to use the email in the most basic way. You can add your own code to it e.g. to get the user data from a User object or from a config file, to use a template for the body.
5+
Below is an example of how to use the email in the most basic way. You can add your own code to it, e.g., to get the user data from a User object or from a config file, to use a template for the body.
66

7-
Note that `addTo` is only one of the methods available for the `Message` class returned by `getMessage()`. Other useful methods that were not included in the example are `addCc()`, `addBcc()`, `addReplyTo()`.
7+
Note that `addTo` is only one of the methods available for the `Message` class returned by `getMessage()`.
8+
Other useful methods that were not included in the example are `addCc()`, `addBcc()`, `addReplyTo()`.
89

9-
The returned type is boolean, but if the `isValid()` method is removed, the returned type becomes `MailResult` which allows the use of `getMessage()` for a more detailed error message. See the `Testing if an e-mail message is valid` section below.
10+
The returned type is boolean, but if the `isValid()` method is removed, the returned type becomes `MailResult` which allows the use of `getMessage()` for a more detailed error message.
11+
See the `Testing if an e-mail message is valid` section below.
1012

1113
```php
1214
public function sendBasicMail()
@@ -19,7 +21,8 @@ public function sendBasicMail()
1921
}
2022
```
2123

22-
It's optional, but recommended to call the above function in a `try-catch` block to display helpful error messages. The next example calls the `sendBasicMail` function from within `UserController`, but you can implement it in other controllers, just make sure that the controller's construct also includes the `FlashMessenger` parameter `$messenger`.
24+
It's optional but recommended to call the above function in a `try-catch` block to display helpful error messages.
25+
The next example calls the `sendBasicMail` function from within `UserController`, but you can implement it in other controllers, just make sure that the controller's construct also includes the `FlashMessenger` parameter `$messenger`.
2326

2427
```php
2528
try {
@@ -34,7 +37,7 @@ try {
3437

3538
## Testing if an e-mail message is valid
3639

37-
After sending an e-mail you can check if the message was valid or not.
40+
After sending an e-mail, you can check if the message was valid or not.
3841
The `$this->mailService->send()->isValid()` method call will return a boolean value.
3942
If the returned result is `true`, the e-mail was valid, otherwise the e-mail was invalid.
4043
In case your e-mail was invalid, you can check for any errors using `$this->mailService->send()->getMessage()`.

0 commit comments

Comments
 (0)