Avatar ·

How to install a specific package version via Composer in PHP?

Hello everyone! I'm a beginner in PHP and Composer. I have a problem: the project requires using an old version of the monolog/monolog library — version 1.0.0, because the new code is incompatible with my framework. But when I write `composer require monolog/monolog`, it installs the latest version (2.x), and everything breaks. I tried adding this to composer.json:\n\n```json\n{\n "require": {\n "monolog/monolog": "1.0.0"\n }\n}\n```\n\nBut after `composer install`, it still installs 2.3.5. What could be the problem? Maybe I'm specifying the version incorrectly? Or do I need to run the command differently? Please advise how to force Composer to install exactly version 1.0.0, not the latest. Thanks in advance!\n\nP.S. I'm using PHP 7.4, if that matters.