diff --git a/Resources/config/routing/routing-sf4.xml b/Resources/config/routing/routing-sf4.xml
index e75a19a..9f0d5af 100644
--- a/Resources/config/routing/routing-sf4.xml
+++ b/Resources/config/routing/routing-sf4.xml
@@ -3,9 +3,5 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
-
- fos_js_routing.controller::indexAction
- js
- js|json
-
+
diff --git a/Resources/config/routing/routing.php b/Resources/config/routing/routing.php
new file mode 100644
index 0000000..0bf59aa
--- /dev/null
+++ b/Resources/config/routing/routing.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
+use Symfony\Component\Routing\Loader\XmlFileLoader;
+
+return function (RoutingConfigurator $routes): void {
+ foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT) as $trace) {
+ if (isset($trace['object']) && $trace['object'] instanceof XmlFileLoader && 'doImport' === $trace['function']) {
+ if (__DIR__ === dirname(realpath($trace['args'][3]))) {
+ trigger_deprecation('friendsofsymfony/jsrouting-bundle', '3.6', 'The "routing-sf4.xml" routing configuration file is deprecated, import "routing.php" instead.');
+
+ break;
+ }
+ }
+ }
+
+ $routes->add('fos_js_routing_js', '/js/routing.{_format}')
+ ->methods(['GET'])
+ ->controller('fos_js_routing.controller::indexAction')
+ ->requirements(['_format' => 'js|json'])
+ ->defaults(['_format' => 'js'])
+ ;
+};
diff --git a/Resources/doc/installation.rst b/Resources/doc/installation.rst
index 6444201..5250b85 100644
--- a/Resources/doc/installation.rst
+++ b/Resources/doc/installation.rst
@@ -43,7 +43,7 @@ Load the bundle's routing definition in the application:
.. code-block:: yaml
fos_js_routing:
- resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"
+ resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.php"
Step 4: Publish the Assets
--------------------------
diff --git a/composer.json b/composer.json
index 700ee87..ee1b30e 100644
--- a/composer.json
+++ b/composer.json
@@ -17,9 +17,10 @@
],
"require": {
"php": "^8.0",
+ "symfony/console": "^5.4|^6.4|^7.0",
+ "symfony/deprecation-contracts": "^2.1|^3.0",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/serializer": "^5.4|^6.4|^7.0",
- "symfony/console": "^5.4|^6.4|^7.0",
"willdurand/jsonp-callback-validator": "~1.1|^2.0"
},
"require-dev": {