Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I upgrade Carbon with Laravel 5.6?

I tried in cmd "composer require nesbot/carbon" but I got this:

Your requirements could not be resolved to an installable set of packages.

  Problem 1

    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - laravel/framework v5.6.27 requires nesbot/carbon 1.25.* -> satisfiable by nesbot/carbon[1.25.0] but these conflict with your requirements or minimum-stability.
    - Installation request for laravel/framework (locked at v5.6.27, required as 5.6.*) -> satisfiable by laravel/framework[v5.6.27].


Installation failed, reverting ./composer.json to its original content.
like image 646
Sára Kata Király Avatar asked Jul 13 '18 20:07

Sára Kata Király


People also ask

Can I upgrade laravel 5.8 to 8?

By default, Laravel 5.8 uses PHPUnit 7. However, you may optionally upgrade to PHPUnit 8, which requires PHP >= 7.2.

How can I update my laravel version?

Updating DependenciesUpdate your laravel/framework dependency to ^6.0 in your composer. json file. If installed, update your laravel/passport dependency to ^9.3. 2 in your composer.

What is carbon function in laravel?

The Carbon class is a very useful class of the Laravel to work with the date and time. Different methods of this class have been used in the examples of this tutorial to print date and time in different ways and perform date and time-related tasks.


Video Answer


1 Answers

I don't recommend doing this without extreme caution because there may be a reason why Laravel, or any of your other dependencies, require a very strict version of a package.

With that said, Composer does include a neat trick to alias versions to get around this by specifying an alias version in composer.json:

"require": {
    ...
    "nesbot/carbon": "1.32.0 as 1.25.0"
},

Note the as 1.25.0 which will trick other packages into thinking 1.32.0 is equivalent to 1.25.0 for dependencies. This trick requires exact versions.

like image 147
Devon Avatar answered Oct 04 '22 02:10

Devon