# Error installing php-di on slim 4.8

**URL:** <https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841>\
**Category:** Questions\
**Created:** [June 2, 2021, 2:44pm UTC](https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841 "2021-06-02T14:44:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rifalgar](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@rifalgar](https://discourse.slimframework.com/u/rifalgar)\
**Post date:** [June 2, 2021, 2:44pm UTC](https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841/1 "2021-06-02T14:44:52Z")

</div>

error that appears.

Problem 1  
- php-di/php-di[6.3.0, …, 6.3.3] require psr/container ^1.0 → found psr/container[1.0.0, 1.1.0, 1.1.1] but the package is fixed to 2.0.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.  
- Root composer.json requires php-di/php-di ^6.3 → satisfiable by php-di/php-di[6.3.0, 6.3.1, 6.3.2, 6.3.3].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

---

<div class="post-metadata">

**Author:** ![rifalgar](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@rifalgar](https://discourse.slimframework.com/u/rifalgar)\
**Post date:** [June 5, 2021, 3:00pm UTC](https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841/2 "2021-06-05T15:00:21Z")

</div>

thanks it worked correctly for me

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [July 27, 2021, 5:28pm UTC](https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841/3 "2021-07-27T17:28:02Z")

</div>

Today I had the same error message.  
To fix this error, run: `composer require php-di/php-di --with-all-dependencies`

---

<div class="post-metadata">

**Author:** ![henry](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/henry/32/1368_2.png) [@henry](https://discourse.slimframework.com/u/henry)\
**Post date:** [August 12, 2021, 5:38am UTC](https://discourse.slimframework.com/t/error-installing-php-di-on-slim-4-8/4841/4 "2021-08-12T05:38:18Z")

</div>

The cause of this error is Slim requiring either PSR/Container 1.x or 2.x, but PHP-DI only works with version 1. When you first install the Slim package, it will install version 2.x of the Container package. It still works fine with 1.x, so you can let composer downgrade the currently installed Container package from 2.x to 1.x. This is what the `--with-all-dependencies` switch does.
