Skip to content

Commit 2eaa519

Browse files
XusifobCopilot
andcommitted
[Feature] - Upgrade to Symfony 7.4, PHP 8.3+, API Platform 4.2 (#40)
* [Feature] - Ajoute le déploiement pour les branches 'main-*' * Initial plan * Update composer.json and configuration for Symfony 7.4, PHP 8.5, API Platform 4.2 Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * Update composer.lock with Symfony 7.4, API Platform 4.2, PHP 8.3 Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * Update Doctrine DBAL code for DBAL 3 compatibility (remove SQLLogger, fix getDatabasePlatform) Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * Add upgrade notes documentation for Symfony 7.4, PHP 8.3+, API Platform 4.2 Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * Remove insecure composer config (secure-http: false) and redundant packagist repository Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * Add migration summary document Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com> * fixes * fixes * fixes * fixes * fixes --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Xusifob <8103268+Xusifob@users.noreply.github.com>
1 parent 091d86a commit 2eaa519

87 files changed

Lines changed: 5053 additions & 3499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build-docker-image/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inputs:
3737
php_version:
3838
description: "The version of PHP to use"
3939
required: false
40-
default: '8.3'
40+
default: '8.5'
4141

4242
runs:
4343
using: 'composite'

.github/actions/create-test-db/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ runs:
77
- name: Set up PHP
88
uses: shivammathur/setup-php@v2
99
with:
10-
php-version: 8.3
10+
php-version: 8.5
1111
extensions: mbstring, intl, pdo_sqlite
1212

1313
- name: Adjust ownership

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: shivammathur/setup-php@v2
1414
with:
1515
extensions: calendar, dom, exif, fileinfo, gd, http, imagick, intl, json, openssl, tidy, xml, zip
16-
php-version: 8.3
16+
php-version: 8.5
1717
tools: composer:v2
1818

1919
- name: Validate composer.json and composer.lock

.github/workflows/production-release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
push:
1010
branches:
1111
- main
12+
- main-*
1213
tags:
1314
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
1415

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PHPUnit
22

33
env:
4-
PHP_VERSION: 8.3
4+
PHP_VERSION: 8.5
55
DATABASE_URL: "/var/test_db.sqlite"
66
DATABASE_ENGINE: "pdo_sqlite"
77

.php-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.3
1+
8.5

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This project contains all scripts to fetch and store data as well as a fully functioning API to fetch this data.
66

7-
The project is based on **PHP 8.3**, **[API-Platform 3.4](https://api-platform.com/docs/v2.5/distribution/)** and **[Symfony 6.4](https://symfony.com/)**
7+
The project is based on **PHP 8.3+**, **[API-Platform 4.2](https://api-platform.com/)** and **[Symfony 7.4](https://symfony.com/)**
88

99
Live API is available at [https://data.instamed.fr](https://data.instamed.fr).
1010

UPGRADE_NOTES.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Upgrade Notes: Symfony 7.4, PHP 8.3+, API Platform 4.2
2+
3+
## Summary
4+
5+
This project has been upgraded from:
6+
- Symfony 6.4 → Symfony 7.4
7+
- PHP 8.3 (min) → PHP 8.3+ (ready for 8.5)
8+
- API Platform 3 → API Platform 4.2
9+
- Doctrine DBAL 2.x → DBAL 3.x
10+
- Doctrine ORM 2.x → ORM 3.x
11+
- Doctrine Annotations 1.x → Annotations 2.x
12+
13+
## Changes Made
14+
15+
### 1. Dependency Updates (composer.json)
16+
- Updated all Symfony packages to 7.4.*
17+
- Updated API Platform to ^4.2
18+
- Updated Doctrine DBAL to ^3.0
19+
- Updated Doctrine ORM to ^2.9 || ^3.0
20+
- Updated Doctrine Annotations to ^2.0
21+
- Updated PHP requirement to >=8.3
22+
- Updated .php-version to 8.5
23+
24+
### 2. Configuration Updates
25+
- Updated API Platform exception namespaces in `config/services.yaml`:
26+
- `ApiPlatform\Core\Bridge\Symfony\Validator\Exception\ValidationException``ApiPlatform\Validator\Exception\ValidationException`
27+
- `ApiPlatform\Core\Exception\ItemNotFoundException``ApiPlatform\Exception\ItemNotFoundException`
28+
29+
### 3. Code Updates for DBAL 3 Compatibility
30+
- Updated `src/Doctrine/PointWrapper.php`:
31+
- Removed SQLLogger usage (deprecated in DBAL 3)
32+
- Fixed `getDriver()->getDatabasePlatform()``getDatabasePlatform()`
33+
- Removed `setFetchMode()` call (deprecated in DBAL 3)
34+
35+
### 4. Documentation
36+
- Updated README.md to reflect new versions
37+
38+
## Compatibility Notes
39+
40+
### Code Already Compatible
41+
The codebase was already well-prepared for these upgrades:
42+
- ✅ Using PHP 8 attributes instead of annotations
43+
- ✅ Using new API Platform Metadata (ApiResource, Get, GetCollection, ApiFilter, ApiProperty)
44+
- ✅ Using DBAL 3 methods like `fetchAllAssociative()` instead of deprecated `fetchAll()`
45+
- ✅ State Providers using new API Platform 4 `ProviderInterface`
46+
- ✅ Filters extending new API Platform 4 classes
47+
48+
### Installation Notes
49+
Due to GitHub rate limiting during the upgrade process, the full `vendor/` directory installation should be completed in your Docker environment or CI/CD pipeline with proper GitHub authentication. The `composer.lock` file has been successfully updated with all correct versions.
50+
51+
To complete the installation:
52+
```bash
53+
# In Docker container
54+
make shell
55+
composer install --ignore-platform-req=ext-redis
56+
```
57+
58+
### Testing
59+
After completing the vendor installation, run the test suite:
60+
```bash
61+
make phpunit
62+
```
63+
64+
## Potential Breaking Changes
65+
66+
### Doctrine DBAL 3
67+
- If any custom code uses DBAL 2-specific methods, they may need updates
68+
- The `wrapper_class` configuration in doctrine.yaml is still present but may need verification
69+
70+
### Symfony 7
71+
- Review any deprecated Symfony 6 features that may have been removed in Symfony 7
72+
- Check for any custom event listeners or subscribers that might need updates
73+
74+
### API Platform 4
75+
- If using any custom decorators or extensions, verify compatibility with API Platform 4
76+
- Check OpenAPI/Swagger documentation generation
77+
78+
## Post-Upgrade Checklist
79+
- [ ] Complete vendor installation
80+
- [ ] Run database migrations if needed
81+
- [ ] Run all tests: `make phpunit`
82+
- [ ] Check application functionality
83+
- [ ] Review logs for deprecation warnings
84+
- [ ] Update CI/CD pipelines if needed
85+
- [ ] Update deployment documentation
86+
87+
## Resources
88+
- [Symfony 7.4 Upgrade Guide](https://symfony.com/doc/current/setup/upgrade_major.html)
89+
- [API Platform 4 Upgrade Guide](https://api-platform.com/docs/core/upgrade-guide/)
90+
- [Doctrine DBAL 3 Upgrade Guide](https://github.com/doctrine/dbal/blob/3.0.x/UPGRADE.md)

composer.json

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,45 @@
44
"type": "project",
55
"license": "proprietary",
66
"require": {
7-
"php": ">=8.3",
7+
"php": ">=8.5",
88
"ext-ctype": "*",
99
"ext-curl": "*",
1010
"ext-iconv": "*",
1111
"ext-intl": "*",
1212
"ext-json": "*",
1313
"ext-zip": "*",
1414
"ext-zlib": "*",
15-
"api-platform/core": "^3",
15+
"api-platform/core": "^4.2",
1616
"cocur/slugify": "^4.6",
17-
"doctrine/annotations": "^1.0",
1817
"doctrine/cache": "^2.2",
19-
"doctrine/dbal": "2.*",
18+
"doctrine/dbal": "^3.0",
2019
"doctrine/doctrine-bundle": "^2",
2120
"doctrine/doctrine-migrations-bundle": "^3.0",
22-
"doctrine/orm": "^2.9",
21+
"doctrine/orm": "^2.9 || ^3.0",
2322
"doctrine/persistence": "^3",
2423
"fakerphp/faker": "^1.20",
2524
"nelmio/cors-bundle": "^2.1",
2625
"odolbeau/phone-number-bundle": "^3.1",
2726
"phpdocumentor/reflection-docblock": "^5.2",
28-
"sentry/sentry-symfony": "^4.3",
29-
"symfony/asset": "6.4.*",
30-
"symfony/cache": "6.4.*",
31-
"symfony/console": "6.4.*",
32-
"symfony/dotenv": "6.4.*",
33-
"symfony/expression-language": "6.4.*",
27+
"sentry/sentry-symfony": "^5.8",
28+
"symfony/asset": "7.4.*",
29+
"symfony/cache": "7.4.*",
30+
"symfony/console": "7.4.*",
31+
"symfony/dotenv": "7.4.*",
32+
"symfony/expression-language": "7.4.*",
3433
"symfony/flex": "^2.4",
35-
"symfony/framework-bundle": "6.4.*",
36-
"symfony/http-client": "6.4.*",
37-
"symfony/property-access": "6.4.*",
38-
"symfony/property-info": "6.4.*",
39-
"symfony/security-bundle": "6.4.*",
40-
"symfony/serializer": "6.4.*",
41-
"symfony/string": "6.4.*",
42-
"symfony/translation": "6.4.*",
43-
"symfony/twig-bundle": "6.4.*",
44-
"symfony/uid": "6.4.*",
45-
"symfony/validator": "6.4.*",
46-
"symfony/yaml": "6.4.*",
34+
"symfony/framework-bundle": "7.4.*",
35+
"symfony/http-client": "7.4.*",
36+
"symfony/property-access": "7.4.*",
37+
"symfony/property-info": "7.4.*",
38+
"symfony/security-bundle": "7.4.*",
39+
"symfony/serializer": "7.4.*",
40+
"symfony/string": "7.4.*",
41+
"symfony/translation": "7.4.*",
42+
"symfony/twig-bundle": "7.4.*",
43+
"symfony/uid": "7.4.*",
44+
"symfony/validator": "7.4.*",
45+
"symfony/yaml": "7.4.*",
4746
"twig/twig": "^3"
4847
},
4948
"require-dev": {
@@ -52,17 +51,17 @@
5251
"liip/functional-test-bundle": "^4.5",
5352
"liip/test-fixtures-bundle": "^2",
5453
"phpspec/prophecy-phpunit": "^2.0",
55-
"phpstan/phpstan": "^1.10",
54+
"phpstan/phpstan": "^1.12",
5655
"phpunit/phpunit": "^10.0",
5756
"rector/rector": "^0.15",
5857
"squizlabs/php_codesniffer": "^3.7",
59-
"symfony/browser-kit": "6.4.*",
60-
"symfony/css-selector": "6.4.*",
61-
"symfony/debug-bundle": "6.4.*",
58+
"symfony/browser-kit": "7.4.*",
59+
"symfony/css-selector": "7.4.*",
60+
"symfony/debug-bundle": "7.4.*",
6261
"symfony/maker-bundle": "^1.23",
63-
"symfony/phpunit-bridge": "^6.4",
64-
"symfony/var-dumper": "6.4.*",
65-
"symfony/web-profiler-bundle": "6.4.*"
62+
"symfony/phpunit-bridge": "^7.4",
63+
"symfony/var-dumper": "7.4.*",
64+
"symfony/web-profiler-bundle": "7.4.*"
6665
},
6766
"config": {
6867
"optimize-autoloader": true,
@@ -110,7 +109,7 @@
110109
"extra": {
111110
"symfony": {
112111
"allow-contrib": false,
113-
"require": "6.4.*"
112+
"require": "7.4.*"
114113
}
115114
}
116115
}

0 commit comments

Comments
 (0)