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

aligajani's avatar

Can I have composer dump-autoload -o in my composer scripts instead of php artisan commands?

Because having php artisan clear-compiled or php artisan optimize always results into ReflectionException. So would it make sense if I have this bit of snippet in my composer.json script section?

I am of the opinion that composer dump-autoload -o pretty much does the same work as those two php artisan commands.

For your information, I am seeing this ReflectionException error in my other thread for only a specific listener file. I am using php 7.0 on Mac with Laravel 5.2.36.Also what are the repercussions of running this in production.

"post-install-cmd": [
            "composer dump-autoload -o"
        ],
        "post-update-cmd": [
            "composer dump-autoload -o"
        ],
0 likes
0 replies

Please or to participate in this conversation.