In this case the real “issue” refers to PHP-DI as dependency. The error message is not related to the Slim router or basePath etc. as the title implies.
php-di/php-di 6.4.0 requires psr/container ^1.0
This is a known issue with PHP-DI 6.x, see here:
- Error installing php-di on slim 4.8 - #2 by rifalgar
- Why not use psr/container v2? · Issue #789 · PHP-DI/PHP-DI · GitHub
To solve this you can force composer to “downgrade” to psr/container
v1 with:
composer require php-di/php-di --with-all-dependencies
This would still work with Slim since the interface is not that different.
PHP-DI 7.0 provides support for psr/container
2.0 interfaces.