Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Armata's avatar

composer update broke my laravel project

Hi. I'm using Laravel 5.6 and after I executed composer update command my project broke down with this error:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 21 updates, 0 removals
  - Updating symfony/var-dumper (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating symfony/console (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating symfony/debug (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating nikic/php-parser (v3.1.4 => v3.1.5): Downloading (100%)         
  - Updating symfony/css-selector (v4.0.4 => v4.0.6): Downloading (connecting...Downloading (100%)         
  - Updating symfony/routing (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating symfony/process (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating symfony/http-foundation (v4.0.4 => v4.0.6): Downloading (connectingDownloading (100%)         
  - Updating symfony/event-dispatcher (v4.0.4 => v4.0.6): Downloading (connectinDownloading (100%)         
  - Updating symfony/http-kernel (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating symfony/finder (v4.0.4 => v4.0.6): Downloading (100%)         
  - Updating psr/simple-cache (1.0.0 => 1.0.1): Downloading (100%)         
  - Updating symfony/translation (v3.4.4 => v4.0.6): Downloading (100%)         
  - Updating nesbot/carbon (1.22.1 => 1.24.1): Downloading (100%)         
  - Updating league/flysystem (1.0.42 => 1.0.43): Downloading (100%)         
  - Updating erusev/parsedown (1.6.4 => 1.7.1): Downloading (100%)         
  - Updating laravel/framework (v5.6.3 => v5.6.10): Downloading (100%)         
  - Updating laravel/tinker (v1.0.3 => v1.0.5): Downloading (100%)         
  - Updating socialiteproviders/vkontakte (v3.0.1 => v3.2.1): Downloading (conneDownloading (100%)         
  - Updating phpspec/prophecy (1.7.4 => 1.7.5): Downloading (100%)         
  - Updating phpunit/phpunit (7.0.1 => 7.0.2): Downloading (100%)         
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

   ErrorException  : Declaration of Illuminate\Support\Carbon::__set_state(array $array) should be compatible with Carbon\Carbon::__set_state($state)

  at /home/user/laravel/blog/vendor/laravel/framework/src/Illuminate/Support/Carbon.php: 9
  5: use JsonSerializable;
  6: use Carbon\Carbon as BaseCarbon;
  7: use Illuminate\Support\Traits\Macroable;
  8: 
  9: class Carbon extends BaseCarbon implements JsonSerializable
  10: {
  11:     use Macroable;
  12: 
  13:     /**
  14:      * The custom Carbon JSON serializer.

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Declaration of Illuminate\Support\Carbon::__set_state(array $array) should be compatible with Carbon\Carbon::__set_state($state)", "/home/user/laravel/blog/vendor/laravel/framework/src/Illuminate/Support/Carbon.php", ["/home/user/laravel/blog/vendor/composer/../laravel/framework/src/Illuminate/Support/Carbon.php"])
      /home/user/laravel/blog/vendor/laravel/framework/src/Illuminate/Support/Carbon.php : 9

  2   include("/home/user/laravel/blog/vendor/laravel/framework/src/Illuminate/Support/Carbon.php")
      /home/user/laravel/blog/vendor/composer/ClassLoader.php : 444

  Please use the argument -v to see more details.
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

It seems something wrong with Carbon package.

How to resolve this problem?

0 likes
16 replies
shez1983's avatar

seems to be.. for now dont update.. and maybe create an issue in laravel.. as i think laravel is not doing it properly "Declaration of Illuminate\Support\Carbon::__set_state(array $array) should be compatible with Carbon\Carbon::__set_state($state)",

tykus's avatar
tykus
Best Answer
Level 104

5.6.11 has fixed this - run composer update to get it.

Armata's avatar

Yep 5.6.11 fixed this problem.

shez1983's avatar

lots of errors have been pushed lately... :s

tykus's avatar

Carbon changed rather than Laravel; the problem was how the dependency is registered in Laravel

36864's avatar

Here we go again. Carbon has made changes to the base Carbon class in the latest release. Revert your carbon version to 1.25.0 for now.

1 like
riazxrazor's avatar

@36864 just added the carbon version u mention in the composer.json and updated it. for now the issue is solved. thanks :)

Exiax's avatar

I have the same problem after running "composer update".

To revert back your carbon version edit your "composer.lock" file and change

"name": "nesbot/carbon",
"version": "1.26.0",

to

"name": "nesbot/carbon",
"version": "1.25.0",

After that run:

composer install

Unfortunately reverting Carbon to 1.25.0 hasn't helped me though. Maybe you have more luck with it...

dyudko44's avatar

Are you seeing the same error as before or now a new error like this?

PHP Fatal error:  Carbon\Carbon and Illuminate\Support\Traits\Macroable define the same property ($macros) in the composition of Illuminate\Support\Carbon. However, the definition differs and is considered incompatible. Class was composed in /home/vagrant/code/laravel/blab/vendor/laravel/framework/src/Illuminate/Support/Carbon.php on line 9
1 like
Exiax's avatar

@dyudko44

I'm seeing the error that you have posted:

PHP Fatal error:  Carbon\Carbon and Illuminate\Support\Traits\Macroable define the same property ($macros) in the composition of Illuminate\Support\Carbon. However, the definition differs and is considered incompatible. Class was composed in F:\xampp\htdocs\houseofdocs\vendor\laravel\framework\src\Illuminate\Support\Carbon.php on line 9

I tried reverting Carbon to 1.25.0 and 1.24.1. Unfortunately neither of those has been successfull, even after deleting the whole "vendor"-folder and running

composer install

again.

36864's avatar

@Exiax can you post your composer.json file and the full output of composer install please?

dyudko44's avatar

I deleted my vendor folder and also deleted composer.lock and then added "nesbot/carbon": "1.25.0" to composer.json and ran composer update and it worked.

Let me know if this works for you too

Exiax's avatar

Hey @dyudko44 and @36864 : seems like i had an issue with my composer.lock file not updating properly. I have deleted composer.lock and added nesbot/carbon": "~1.25.0 to composer.json. After running composer update everything works as it should.

Does Carbon v1.26.0 include any API breaking changes (which would usually require a major version switch to v2.0.0) or what is the underlying problem?

36864's avatar

Carbon, like Laravel, doesn't make any claims about using SemVer. There are several breaking changes between 1.25.0 and 1.26.0.

Please or to participate in this conversation.