Skip to content

Commit bd8baa9

Browse files
committed
file structure & more details
Signed-off-by: Jurj-Bogdan <[email protected]>
1 parent 2606b51 commit bd8baa9

File tree

3 files changed

+85
-10
lines changed

3 files changed

+85
-10
lines changed

docs/book/v5/upgrading/UPGRADE-5.3.md

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,34 @@ This document only covers upgrading from version 5.2.
1111

1212
-------------------------
1313

14-
* [Update Phpstan memory limit](#update-phpstan-memory-limit)
14+
* [Update PHPStan memory limit](#update-phpstan-memory-limit)
1515
* [Update anonymization](#update-anonymization)
1616
* [Update User status and remove isDeleted properties](#update-user-status-and-remove-isdeleted-properties)
1717
* [Update dotkernel/dot-mail to version 5.0](#update-dotkerneldot-mail-to-version-50)
1818
* [Add post install script](#add-post-install-script)
1919
* [Remove post-create-project-cmd](#remove-post-create-project-cmd)
20+
* [Ignore development files on production env](#ignore-development-files-on-production-env)
2021
* [Update security.txt](#update-securitytxt)
2122
* [Update coding standards](#update-coding-standards)
22-
* [Fix codecov.yml](#fix-codecovyml)
2323
* [Update Qodana configuration](#update-qodana-configuration)
2424
* [Remove laminas/laminas-http](#remove-laminaslaminas-http)
2525

26-
### Update Phpstan memory limit
26+
### Update PHPStan memory limit
27+
28+
Following PHPStan's introduction in version 5.2 for the reasons described on the [Dotkernel blog](https://www.dotkernel.com/php-development/static-analysis-replacing-psalm-with-phpstan/) a minor issue has cropped up:
29+
with the default `memory_limit=128M` on our WSL containers, PHPStan runs out of memory
2730

2831
* Add the `--memory-limit 1G` option to the `static-analysis` script found in `composer.json`
29-
> With the default `memory_limit=128M` on our WSL containers, PHPStan runs out of memory
30-
>
3132
> Note that you can set the memory limit to a value of your choosing, with a recommended minimum of 256M
3233
3334
### Update anonymization
3435

36+
By default, Dotkernel API uses "soft delete" for it's `User` entities in order to preserve the database entries.
37+
38+
Anonymization is used to make sure any sensitive information is scrubbed from the system, with the `User`'s `identity`, `email`, `firstName` and `lastName` properties being overwritten by a unique placeholder.
39+
40+
Version 5.3 is adding an optional suffix from a configuration file, from where it can be used anywhere in the application.
41+
3542
* Add the `userAnonymizeAppend` key to the returned array in `config/autoload/local.php`, as well as to the distributed`config/autoload/local.php.dist`
3643

3744
```php
@@ -56,6 +63,12 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
5663
5764
### Update User status and remove isDeleted properties
5865

66+
Up to and including version 5.2, the `User` entity made use of the `UserStatusEnum` to mark the account status (`active` or `inactive`) and marked deleted accounts with the `isDeleted` property.
67+
68+
Starting from version 5.3 the `isDeleted` property has been removed because, by default, there is no use in having both it and the status property.
69+
70+
As such, a new `Deleted` case for `UserStatusEnum` is now used to mark a deleted account and remove the redundancy.
71+
5972
* [BC Break] Remove the `isDeleted` property from the `User` class, alongside all usages, as seen in the [pull request](https://github.com/dotkernel/api/pull/359/files)
6073
* Add a new "deleted" case to `UserStatusEnum`, which is to be used instead of the previous `isDeleted` property
6174
* Update the database and it's migrations to reflect the new structure
@@ -65,6 +78,14 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
6578
6679
### Update `dotkernel/dot-mail` to version 5.0
6780

81+
Dotkernel API uses `dotkernel/dot-mail` to handle the mailing service, which in versions older than 5.0 was based on `laminas/laminas-mail`.
82+
83+
Due to the deprecation of `laminas/laminas-mail`, a decision was made to switch `dot-mail` to using `symfony/mailer` starting from version 5.0.
84+
85+
To make the API more future-proof, the upgrade to the new version of `dot-mail` was necessary.
86+
87+
The default usage of the mailer remains unchanged, with the only required updates being to configuration, as described below:
88+
6889
* Bump `dotkernel/dot-mail` to "^5.0" in `composer.json`
6990
* As the mail configuration file is now directly copied from the vendor via [script](#add-post-install-script), remove the existing `config/autoload/mail.global.php[.dist]` file(s)
7091
* Update the content for each of these configuration files to reflect the new structure from [dotkernel/dot-mail](https://github.com/dotkernel/dot-mail/blob/5.0/config/mail.global.php.dist)
@@ -75,6 +96,8 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
7596
7697
### Remove `post-create-project-cmd`
7798

99+
Installing the API via `composer create-project` is not recommended, and because of this the `post-create-project-cmd` has been removed.
100+
78101
* Remove the `post-create-project-cmd` key found under `scripts` in `composer.json`
79102

80103
```json
@@ -85,6 +108,14 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
85108

86109
### Add post install script
87110

111+
To make installing the API less of a hassle, a new post installation script was added.
112+
113+
This script generates all the configuration files required by default, leaving the user to simply complete the relevant data.
114+
115+
> Note that the script will not overwrite existing configuration files, preserving any user data
116+
>
117+
> In case the structure of a configuration file needs updating (such as [mail.local.php](#update-dotkerneldot-mail-to-version-50) in this update), simply running the script *will not* make the changes
118+
88119
* Add `bin/composer-post-install-script.php` to automate the post installation copying of distributed configuration files
89120
* Add the following under the `scripts` key in `composer.json`:
90121

@@ -106,13 +137,49 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
106137
107138
> The command can be manually run via `php bin/composer-post-install-script.php`
108139

140+
### Ignore development files on production env
141+
142+
These tweaks were added to make sure development files remain untouched on production environments.
143+
144+
* Restrict codecov to development mode by changing the following section from `.github/workflows/codecov.yml`:
145+
146+
Before:
147+
148+
```yaml
149+
- name: Install dependencies with composer
150+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
151+
```
152+
153+
After:
154+
155+
```yaml
156+
- name: Install dependencies with composer
157+
env:
158+
COMPOSER_DEV_MODE: 1
159+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
160+
```
161+
162+
* Edit `.laminas-ci/pre-run.sh` script by changing `echo "Running $COMMAND"` to `echo "Running pre-run $COMMAND"` and delete the following line:
163+
164+
```shell
165+
cp config/autoload/mail.global.php.dist config/autoload/mail.global.php
166+
```
167+
109168
### Update security.txt
110169

170+
Updated the `security.txt` file to define the preferred language of the security team.
171+
172+
It is recommended that the `Expires` tag is also updated if necessary.
173+
111174
* Add the `Preferred-Languages` key to `public/.well-known/security.txt`
112175
> You may include more than one language as comma separated language tags
113176

114177
### Update coding standards
115178

179+
Dotkernel API uses `laminas/laminas-coding-standard` as its baseline ruleset to ensure adherence to PSR-1 and PSR-12.
180+
181+
As this package had a major release, the minimum version the API uses was also bumped.
182+
116183
* Bump `laminas/laminas-coding-standard` to `^3.0` in `composer.json`
117184
* Add the following to `phpcs.xml` to prevent issues with the fully qualified names from `config/config.php`:
118185

@@ -123,11 +190,11 @@ $user->setIdentity($placeholder . $this->config['userAnonymizeAppend']) //...
123190
</rule>
124191
```
125192

126-
### Fix codecov.yml
193+
### Update Qodana configuration
127194

128-
* Change `COMPOSER_DEV_MODE=1` to the correct syntax `COMPOSER_DEV_MODE: 1`
195+
The Qodana code quality workflow has changed its default PHP version to 8.4, which is unsupported by Dotkernel API, resulting in errors.
129196

130-
### Update Qodana configuration
197+
The issue was fixed by restricting Qodana to the supported PHP versions.
131198

132199
* Update `.github/workflows/qodana_code_quality.yml`, specifying the supported PHP versions by adding the `strategy` key:
133200

@@ -155,5 +222,9 @@ with:
155222

156223
### Remove laminas/laminas-http
157224

225+
Prior to version 5.3, `laminas/laminas-http` was only used in 2 test files to assert if correct status codes were returned.
226+
227+
This dependency was removed, as the usage in tests was replaced with the existing `StatusCodeInterface`.
228+
158229
* Remove `laminas/laminas-http` from `composer.json`
159230
* Replace all uses of `Laminas\Http\Response` with `Fig\Http\Message\StatusCodeInterface` in `AuthorizationMiddlewareTest.php` and `ContentNegotiationMiddlewareTest.php`
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ For each new release you need implement the modifications from its pull requests
1414
It is recommended to copy the release info into your project's CHANGELOG.md file.
1515
This allows you to track your API's version and keep your project up-to-date with future releases.
1616

17-
Starting from [version 5.3](upgrading/UPGRADE-5.3.md) the upgrading procedure is detailed version to version.
17+
## Version to version upgrading
18+
19+
Starting from [version 5.3](UPGRADE-5.3.md) the upgrading procedure is detailed version to version.

mkdocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ nav:
2222
- "Doctrine ORM": v5/installation/doctrine-orm.md
2323
- "Test the Installation": v5/installation/test-the-installation.md
2424
- "FAQ": v5/installation/faq.md
25-
- Upgrading: v5/upgrading.md
25+
- Upgrading:
26+
- "Upgrading": v5/upgrading/upgrading.md
27+
- "Upgrading 5.2 to 5.3": v5/upgrading/UPGRADE-5.3.md
2628
- Flow:
2729
- "Middleware Flow": v5/flow/middleware-flow.md
2830
- "Default Library Flow": v5/flow/default-library-flow.md

0 commit comments

Comments
 (0)