PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 7, 2022

[FIXED] Symfony 4 - Problems installing Bundles

 March 07, 2022     composer-php, symfony, symfony4     No comments   

Issue

I try to install a bundle for barcodes, but I get an error, perhaps somebody could help me:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.3.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for __root__ dev-master -> satisfiable by __root__[dev-master].
    - alpin11/twig-barcode v1.0 requires symfony/symfony ^3.4 || ^4.0 -> satisfiable by symfony/symfony[v4.3.0, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9].
    - symfony/symfony v4.3.10 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.11 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.3 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.4 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.5 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.6 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.7 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.8 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.9 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.0 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.1 conflicts with __root__[dev-master].
    - symfony/symfony v4.3.2 conflicts with __root__[dev-master].
    - Installation request for alpin11/twig-barcode ^1.0 -> satisfiable by alpin11/twig-barcode[v1.0].


Installation failed, reverting ./composer.json to its original content.

This is my composer.json:

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "dompdf/dompdf": "^0.8.3",
        "endroid/qr-code-bundle": "^3.3",
        "phpoffice/phpspreadsheet": "^1.11",
        "sensio/framework-extra-bundle": "^5.3",
        "sensiolabs/security-checker": "^5.0",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "4.3.*",
        "symfony/console": "4.3.*",
        "symfony/dotenv": "4.3.*",
        "symfony/flex": "^1.1",
        "symfony/form": "4.3.*",
        "symfony/framework-bundle": "4.3.*",
        "symfony/maker-bundle": "^1.11",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "4.3.*",
        "symfony/serializer-pack": "^1.0",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/twig-bundle": "4.3.*",
        "symfony/validator": "4.3.*",
        "symfony/web-server-bundle": "4.3.*",
        "symfony/yaml": "4.3.*",
        "twig/extensions": "^1.5"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "security-checker security:check": "script"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.3.*"
        }
    },
    "require-dev": {
        "symfony/profiler-pack": "^1.0",
        "symfony/console": "^4.3"
    }
}

Solution

You should complain to the provider of that package for making a bad decision: the package enforces the installation of symfony/symfony (the full package of all Symfony components), while all current projects should depend on the individual components. That's what your project does: it installs each needed component, and not the whole framework.

And that's where stuff gets difficult for you: the full framework package symfony/symfony contains all components and lists them in the replaces section. Installing both the framework package and single components leads to problems and is not possible. But as that barcode package depends on the whole framework, and your own application depends on single components, the installation can not continue.

If you really want to use this package (there might be alternatives that structure their dependencies better), you can remove all Symfony components (those with the version constraint 4.3.*) from your composer.json and instead require symfony/symfony:4.3.*. Afterwards, that package should be installable



Answered By - Nico Haase
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing