Problem Using Valet+ for local development

I just switched my local dev platform to Valet+ from the official Laravel Valet. The reason being Valet+ adds a bunch of features that Valet does not have (Ability to switch PHP version, Mailhog, command line DB features, and more).

Problem is, Kirby for some reason no longer detects the server name, so all your URLs will be wrong. This worked fine with the official Valet.

To get it going, you need to set the URL for local test server in your config.php. This is whatever you set with the valet link command.

c::set('url', 'http://yourtestname.test');  

You will need to set it back to the default in your live domain config:

c::set('url', false);

Instead of setting it to false later in the live domain config, it would make more sense to use a local config file for setting the domain, config.yourtestname.test.php

Edit: Unless that isn’t possible because Kirby doesn’t recognize it in the first place…

1 Like

I just tested that. config for local doesn’t work, you need to set it in config.php then unset in the other configs you have.

Too bad…:disappointed: (and some more chars)

Yup. But workable. It’s strange because it’s built on top of the official Valet, they have simply extended its features.

I tried to verify it with $domain = server::get('server_name'); but it comes up empty. Something peculiar in the way Valet+ is setup I imagine.

Well, after a short excursion with Valet, I’m currently back to MAMP anyway.

1 Like

I used to use MAMP, but got stuck at one point when I needed to run something that was beyond what was built into mamp (at that time). Then i built my own server as a seperate computer. Then I rolled my own with VirtualBox to free up a plug socket… then vagrant (Homesetead & Scotchbox)… then Valet.

I like Valet because it happily coexists with Vagrant and it doesn’t cost anything.

It’s always a never ending search for the perfect setup… :slight_smile:

Out of curiosity, what made you go back to mamp?

Oh boy. It gets worse. Kirby doesn’t like Valet+. My sites running but clicking the main menu links only shows the home page, even though the URL in the address bar is changing. I guess the problem runs deeper then it simply not seeing the server name.

Back to vanilla Valet…

Well, since MAMP works for me most of the time, I don’t really see a reason to change a running system. Maybe it’s very subjective, but I found it easier to set up new projects and change PHP version with Mamp then with Valet. Also, for the occasional MySQL stuff (although MySQL is where MAMP has several times failed me). And I don’t really want to waste time with this never ending quest for the right tool, rather invest it in developing stuff.

2 Likes