routing with webpack encore, symfony5

I am developing with symfony 5.3 and webpack encore and I need to call symfony routes from js code.

In order to integrate symfony routes to javascript, I am following Symfony 4 - Webpack-encore use FosJsRouting : Routing is not defined. With this bundle I should write $.ajax({ url: Routing.generate("route_of_symfony"), .......

I am installing jsrouting-bundle with symfony 5 but I am getting some errors:

Problem 1
    - Root composer.json requires friendsofsymfony/jsrouting-bundle ^3.0 -> satisfiable by friendsofsymfony/jsrouting-bundle[3.0.0].
    - friendsofsymfony/jsrouting-bundle 3.0.0 requires symfony/framework-bundle ^5.4|^6.0 -> found symfony/framework-bundle[v5.4.0, v5.4.1, v6.0.0, v6.0.1] but it conflicts with your root composer.json require (5.3.*).

I asked and got this answer https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/issues/422#issuecomment-999818579 where it is not compatible with 5.3

is there some workarround o other way to get routes from symfony in javascript with webpack encore ?

This is my composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.4",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.4",
        "doctrine/doctrine-migrations-bundle": "^3.1",
        "doctrine/orm": "^2.10",
        "knpuniversity/oauth2-client-bundle": "^2.8",
        "phpdocumentor/reflection-docblock": "^5.2",
        "sensio/framework-extra-bundle": "^6.2",
        "sonata-project/entity-audit-bundle": "^1.6",
        "stevenmaguire/oauth2-keycloak": "^2.2",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "5.3.*",
        "symfony/console": "5.3.*",
        "symfony/dotenv": "5.3.*",
        "symfony/expression-language": "5.3.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "5.3.*",
        "symfony/framework-bundle": "5.3.*",
        "symfony/google-mailer": "5.3.*",
        "symfony/http-client": "5.3.*",
        "symfony/intl": "5.3.*",
        "symfony/mailer": "5.3.*",
        "symfony/mime": "5.3.*",
        "symfony/monolog-bundle": "^3.7",
        "symfony/notifier": "5.3.*",
        "symfony/process": "5.3.*",
        "symfony/property-access": "5.3.*",
        "symfony/property-info": "5.3.*",
        "symfony/proxy-manager-bridge": "5.3.*",
        "symfony/runtime": "5.3.*",
        "symfony/security-bundle": "5.3.*",
        "symfony/serializer": "5.3.*",
        "symfony/string": "5.3.*",
        "symfony/translation": "5.3.*",
        "symfony/twig-bundle": "5.3.*",
        "symfony/validator": "5.3.*",
        "symfony/web-link": "5.3.*",
        "symfony/webpack-encore-bundle": "^1.12",
        "symfony/yaml": "5.3.*",
        "twig/cssinliner-extra": "^3.3",
        "twig/extra-bundle": "^3.3",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^9.5",
       "symfony/browser-kit": "5.3.*",
        "symfony/css-selector": "5.3.*",
        "symfony/debug-bundle": "5.3.*",
        "symfony/maker-bundle": "^1.34",
        "symfony/phpunit-bridge": "^5.3",
        "symfony/stopwatch": "5.3.*",
        "symfony/web-profiler-bundle": "5.3.*"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.3.*"
        }
    }
}

Thanks.



from Recent Questions - Stack Overflow https://ift.tt/3eqd3aM
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation