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

deraafmedia's avatar

Laravel Herd use isolated php version via terminal

Hi guys, I have a question related to Laravel Herd (or Valet).

I use Laravel Herd. I isolated one of my project to use an older PHP version. This works fine and if I access domain.test via the browser the specified PHP version is used. However. In the terminal if I navigate to this project and use php -v I see the globally used PHP version. If I use herd php -v, I do see the version specified for this project.

As a workaround (at least I think this is a workaround) I use the following aliases:

alias php="herd php" alias composer="herd composer"

I previously used aliases like this for valet as well.

It al works fine. But is this the correct way? Or is there another way to use the isolated version in the terminal?

0 likes
2 replies
marcgaumont's avatar

had the same problem, if I did which php i see the php 8.3 which is my global herd version but not isolated... I did not know we could or should user herd php... herd composer... not my composer installs work ! thanks

kiwi0134's avatar

Using the herd commands is the correct way. They ensure that you’re actually using the correct environment for your project.

Please or to participate in this conversation.