Skip to content

Conversation

nicolas-grekas
Copy link
Member

Q A
License MIT
Doc issue/PR -

Side-kick of symfony/symfony#61492

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) August 22, 2025 09:01
Copy link

github-actions bot commented Aug 22, 2025

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1448/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1448/index.json
  2. Install the package(s) related to this recipe:

    composer req symfony/flex
    composer req 'symfony/routing:^7.4'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

symfony/routing

3.3 vs 4.0
diff --git a/symfony/routing/3.3/config/routes.yaml b/symfony/routing/4.0/config/routes.yaml
index 59d1945f..c3283aa2 100644
--- a/symfony/routing/3.3/config/routes.yaml
+++ b/symfony/routing/4.0/config/routes.yaml
@@ -1,6 +1,3 @@
-# This file is the entry point to configure your own HTTP routes.
-# Files in the routes/ subdirectory configure the routes for your dependencies.
-
 #index:
 #    path: /
-#    defaults: { _controller: 'App\Controller\DefaultController::index' }
+#    controller: App\Controller\DefaultController::index
4.0 vs 4.2
diff --git a/symfony/routing/4.2/config/packages/routing.yaml b/symfony/routing/4.2/config/packages/routing.yaml
new file mode 100644
index 00000000..7e977620
--- /dev/null
+++ b/symfony/routing/4.2/config/packages/routing.yaml
@@ -0,0 +1,3 @@
+framework:
+    router:
+        utf8: true
4.2 vs 5.1
diff --git a/symfony/routing/4.2/config/packages/routing.yaml b/symfony/routing/5.1/config/packages/routing.yaml
index 7e977620..b45c1cec 100644
--- a/symfony/routing/4.2/config/packages/routing.yaml
+++ b/symfony/routing/5.1/config/packages/routing.yaml
@@ -1,3 +1,7 @@
 framework:
     router:
         utf8: true
+
+        # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
+        # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
+        #default_uri: http://localhost
5.1 vs 5.3
diff --git a/symfony/routing/5.1/config/packages/prod/routing.yaml b/symfony/routing/5.1/config/packages/prod/routing.yaml
deleted file mode 100644
index b3e6a0af..00000000
--- a/symfony/routing/5.1/config/packages/prod/routing.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-framework:
-    router:
-        strict_requirements: null
diff --git a/symfony/routing/5.1/config/packages/routing.yaml b/symfony/routing/5.3/config/packages/routing.yaml
index b45c1cec..4b766ce5 100644
--- a/symfony/routing/5.1/config/packages/routing.yaml
+++ b/symfony/routing/5.3/config/packages/routing.yaml
@@ -5,3 +5,8 @@ framework:
         # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
         # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
         #default_uri: http://localhost
+
+when@prod:
+    framework:
+        router:
+            strict_requirements: null
diff --git a/symfony/routing/5.1/manifest.json b/symfony/routing/5.3/manifest.json
index c0c66b64..a3f340ed 100644
--- a/symfony/routing/5.1/manifest.json
+++ b/symfony/routing/5.3/manifest.json
@@ -2,5 +2,8 @@
     "copy-from-recipe": {
         "config/": "%CONFIG_DIR%/"
     },
-    "aliases": ["router"]
+    "aliases": ["router"],
+    "conflict": {
+        "symfony/framework-bundle": "<5.3"
+    }
 }
5.3 vs 6.0
diff --git a/symfony/routing/5.3/config/routes.yaml b/symfony/routing/6.0/config/routes.yaml
index c3283aa2..5b102f60 100644
--- a/symfony/routing/5.3/config/routes.yaml
+++ b/symfony/routing/6.0/config/routes.yaml
@@ -1,3 +1,7 @@
-#index:
-#    path: /
-#    controller: App\Controller\DefaultController::index
+controllers:
+    resource: ../src/Controller/
+    type: annotation
+
+kernel:
+    resource: ../src/Kernel.php
+    type: annotation
6.0 vs 6.1
diff --git a/symfony/routing/6.0/config/routes.yaml b/symfony/routing/6.1/config/routes.yaml
index 5b102f60..9286e818 100644
--- a/symfony/routing/6.0/config/routes.yaml
+++ b/symfony/routing/6.1/config/routes.yaml
@@ -1,7 +1,3 @@
 controllers:
     resource: ../src/Controller/
-    type: annotation
-
-kernel:
-    resource: ../src/Kernel.php
-    type: annotation
+    type: attribute
6.1 vs 6.2
diff --git a/symfony/routing/6.1/config/routes.yaml b/symfony/routing/6.2/config/routes.yaml
index 9286e818..41ef8140 100644
--- a/symfony/routing/6.1/config/routes.yaml
+++ b/symfony/routing/6.2/config/routes.yaml
@@ -1,3 +1,5 @@
 controllers:
-    resource: ../src/Controller/
+    resource:
+        path: ../src/Controller/
+        namespace: App\Controller
     type: attribute
diff --git a/symfony/routing/6.1/manifest.json b/symfony/routing/6.2/manifest.json
index a3f340ed..db102603 100644
--- a/symfony/routing/6.1/manifest.json
+++ b/symfony/routing/6.2/manifest.json
@@ -4,6 +4,6 @@
     },
     "aliases": ["router"],
     "conflict": {
-        "symfony/framework-bundle": "<5.3"
+        "symfony/framework-bundle": "<6.2"
     }
 }
6.2 vs 7.0
diff --git a/symfony/routing/6.2/config/packages/routing.yaml b/symfony/routing/7.0/config/packages/routing.yaml
index 4b766ce5..8166181c 100644
--- a/symfony/routing/6.2/config/packages/routing.yaml
+++ b/symfony/routing/7.0/config/packages/routing.yaml
@@ -1,7 +1,5 @@
 framework:
     router:
-        utf8: true
-
         # Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
         # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
         #default_uri: http://localhost
diff --git a/symfony/routing/6.2/manifest.json b/symfony/routing/7.0/manifest.json
index db102603..fd4536e6 100644
--- a/symfony/routing/6.2/manifest.json
+++ b/symfony/routing/7.0/manifest.json
@@ -4,6 +4,6 @@
     },
     "aliases": ["router"],
     "conflict": {
-        "symfony/framework-bundle": "<6.2"
+        "symfony/framework-bundle": "<7.0"
     }
 }
7.0 vs 7.4
diff --git a/symfony/routing/7.0/config/routes.yaml b/symfony/routing/7.4/config/routes.yaml
index 41ef8140..64d7a9a8 100644
--- a/symfony/routing/7.0/config/routes.yaml
+++ b/symfony/routing/7.4/config/routes.yaml
@@ -1,5 +1,5 @@
+# $schema: ../vendor/symfony/routing/Loader/schema/routing.schema.json
+
 controllers:
-    resource:
-        path: ../src/Controller/
-        namespace: App\Controller
-    type: attribute
+    resource: attributes
+    type: tagged_services

yceruto
yceruto previously approved these changes Aug 22, 2025
fabpot added a commit to symfony/symfony that referenced this pull request Aug 22, 2025
…ttributes found on controller services (nicolas-grekas)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle][Routing] Auto-register routes from attributes found on controller services

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | #60946
| License       | MIT

Currently, controllers have to be put in predetermined directories for their route attributes to be parsed.

This PR enables auto-registration of controllers based on their service definition, independently of where they're located in the app - which means they could be put anywhere now.

config/routes.yaml before:
```yaml
controllers:
    resource:
        path: ../src/Controller/
        namespace: App\Controller
    type: attribute
```

config/routes.yaml after:
```yaml
controllers:
    resource: attributes
    type: tagged_services
```

Recipe update at symfony/recipes#1448

Commits
-------

d0bbf04 [Routing][FrameworkBundle] Auto-register routes from attributes found on controller services
@symfony-recipes-bot symfony-recipes-bot merged commit 64f21c6 into main Aug 22, 2025
1 of 2 checks passed
@symfony-recipes-bot symfony-recipes-bot deleted the route-controllers branch August 22, 2025 14:25
symfony-splitter pushed a commit to symfony/routing that referenced this pull request Aug 22, 2025
…ttributes found on controller services (nicolas-grekas)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle][Routing] Auto-register routes from attributes found on controller services

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | #60946
| License       | MIT

Currently, controllers have to be put in predetermined directories for their route attributes to be parsed.

This PR enables auto-registration of controllers based on their service definition, independently of where they're located in the app - which means they could be put anywhere now.

config/routes.yaml before:
```yaml
controllers:
    resource:
        path: ../src/Controller/
        namespace: App\Controller
    type: attribute
```

config/routes.yaml after:
```yaml
controllers:
    resource: attributes
    type: tagged_services
```

Recipe update at symfony/recipes#1448

Commits
-------

d0bbf04cefc [Routing][FrameworkBundle] Auto-register routes from attributes found on controller services
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Aug 22, 2025
…ttributes found on controller services (nicolas-grekas)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle][Routing] Auto-register routes from attributes found on controller services

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | #60946
| License       | MIT

Currently, controllers have to be put in predetermined directories for their route attributes to be parsed.

This PR enables auto-registration of controllers based on their service definition, independently of where they're located in the app - which means they could be put anywhere now.

config/routes.yaml before:
```yaml
controllers:
    resource:
        path: ../src/Controller/
        namespace: App\Controller
    type: attribute
```

config/routes.yaml after:
```yaml
controllers:
    resource: attributes
    type: tagged_services
```

Recipe update at symfony/recipes#1448

Commits
-------

d0bbf04cefc [Routing][FrameworkBundle] Auto-register routes from attributes found on controller services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants