How to install a specific version of package using Composer

0 votes
I am trying to install a specific version of a package using Composer. I tried composer install and composer require but they are installing the latest version of the package. What if I want an older version?
Apr 1, 2020 in PHP by kartik
• 37,520 points
3,627 views

1 answer to this question.

0 votes

Hello,

Just use php composer.phar require

For example :

php composer.phar require doctrine/mongodb-odm-bundle 3.0

Also available with install.

https://getcomposer.org/doc/03-cli.md#require https://getcomposer.org/doc/03-cli.md#install

Hope this works fine!!

Thank you!

answered Apr 1, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
1 answer

How to Check for a Specific Type of Object in PHP

Hello @kartik, You can use instanceof: if ($pdo instanceof PDO) ...READ MORE

answered Oct 30, 2020 in PHP by Niroj
• 82,840 points
1,797 views
0 votes
1 answer

How to check if a string contains a specific text using php?

Hello @kartik, Use the strpos function:  $haystack = "foo bar baz"; $needle ...READ MORE

answered Nov 10, 2020 in PHP by Niroj
• 82,840 points
4,240 views
0 votes
1 answer

How to read a list of files from a folder using PHP?

Try this: $files = array_values(array_filter(scandir($path), function($file) use ($path) ...READ MORE

answered Nov 18, 2020 in PHP by Niroj
• 82,840 points
607 views
0 votes
0 answers

How can I remove a package from Laravel using PHP Composer?

What is the best way to remove ...READ MORE

Jun 25, 2022 in PHP by narikkadan
• 63,600 points
545 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,995 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,691 views
0 votes
1 answer

How to get the list of specific files in a directory using php?

Hello @kartik, You'll be wanting to use glob() Example: $files = ...READ MORE

answered Nov 6, 2020 in PHP by Niroj
• 82,840 points
2,231 views
0 votes
1 answer

How to get a list of user accounts using the command line in MySQL?

Hello @kartik, Use this query: SELECT User FROM mysql.user; Which ...READ MORE

answered Aug 18, 2020 in PHP by Niroj
• 82,840 points
1,566 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP