laravel / valet

A more enjoyable local development experience for Mac.
https://laravel.com/docs/valet
MIT License
2.51k stars 695 forks source link

Valet link with --isolate doesn't pass custom name #1386

Closed chris-ware closed 1 year ago

chris-ware commented 1 year ago

Description:

When running valet link --isolate with a custom name that doesn't match the directory name, such as valet link foobar --isolate, where the directory the site is in may be foobar.com, the isolate command doesn't seem to receive the custom name and ends up failing with the following validation error.

In Site.php line 182:

  The [foobar.com] site could not be found in Valet's site list.  

link [--secure] [--isolate] [--] [<name>]

Steps To Reproduce:

  1. Checkout a site
  2. Add a .valetrc file with an isolatable php version
  3. valet link --isolate foobar

Diagnosis

sw_vers
ProductName:   macOS
ProductVersion: 12.5.1
BuildVersion:   21G83
valet --version
Laravel Valet 4.0.0
cat ~/.config/valet/config.json
{
    "tld": "test",
    "loopback": "127.0.0.1",
    "paths": [
        "/Users/chrisware/.config/valet/Sites"
    ]
}
cat ~/.composer/composer.json
{
    "require": {
        "beyondcode/expose": "^2.2",
        "laravel/envoy": "^2.8",
        "laravel/forge-cli": "^1.3",
        "laravel/installer": "^4.2",
        "laravel/pint": "^1.1",
        "laravel/valet": "^4.0",
        "statamic/cli": "^2.4",
        "tightenco/takeout": "^2.1"
    },
    "config": {
        "allow-plugins": {
            "ergebnis/composer-normalize": true
        },
    }
}
composer global diagnose
Changed current directory to /Users/chrisware/.composer
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK git version 2.32.1
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: You are not running the latest stable version, run `composer self-update` to update (2.5.3 => 2.5.4)
Composer version: 2.5.3
PHP version: 8.2.3
PHP binary path: /opt/homebrew/Cellar/php/8.2.3/bin/php
OpenSSL version: OpenSSL 1.1.1t  7 Feb 2023
cURL version: 7.87.0 libz 1.2.11 ssl (SecureTransport) OpenSSL/1.1.1t
zip: extension present, unzip present, 7-Zip not available
composer global outdated
Changed current directory to /Users/chrisware/.composer
Info from https://repo.packagist.org: #StandWithUkraine
Legend:
! patch or minor release available - update recommended
~ major release available - update possible

Direct dependencies required in composer.json:
beyondcode/expose                  2.5.0   ! 2.6.1   Create public URLs for ...
laravel/installer                  v4.4.0  ! v4.5.0  Laravel application ins...
laravel/pint                       v1.4.1  ! v1.6.0  An opinionated code for...
tightenco/takeout                  v2.3.1  ! v2.4.0  Manage your dev depende...

Transitive dependencies not required in composer.json:
guzzlehttp/psr7                    1.9.0   ~ 2.4.4   PSR-7 message implement...
illuminate/collections             v9.51.0 ~ v10.4.1 The Illuminate Collecti...
illuminate/conditionable           v9.51.0 ~ v10.4.1 The Illuminate Conditio...
illuminate/container               v9.51.0 ~ v10.4.1 The Illuminate Containe...
illuminate/contracts               v9.51.0 ~ v10.4.1 The Illuminate Contract...
illuminate/macroable               v9.51.0 ~ v10.4.1 The Illuminate Macroabl...
illuminate/support                 v9.51.0 ~ v10.4.1 The Illuminate Support ...
phpseclib/phpseclib                3.0.18  ! 3.0.19  PHP Secure Communicatio...
symfony/console                    v6.2.5  ! v6.2.7  Eases the creation of b...
symfony/deprecation-contracts      v3.2.0  ! v3.2.1  A generic function and ...
symfony/event-dispatcher           v6.2.5  ! v6.2.7  Provides tools that all...
symfony/event-dispatcher-contracts v3.2.0  ! v3.2.1  Generic abstractions re...
symfony/process                    v6.2.5  ! v6.2.7  Executes commands in su...
symfony/service-contracts          v3.2.0  ! v3.2.1  Generic abstractions re...
symfony/string                     v6.2.5  ! v6.2.7  Provides an object-orie...
symfony/translation                v6.2.5  ! v6.2.7  Provides tools to inter...
symfony/translation-contracts      v3.2.0  ! v3.2.1  Generic abstractions re...
ls -al /etc/sudoers.d/
total 16
drwxr-xr-x   4 root  wheel   128 20 Aug  2022 .
drwxr-xr-x  81 root  wheel  2592 30 Jan 13:27 ..
-rw-r--r--   1 root  wheel    83 26 Jan  2022 brew
-rw-r--r--   1 root  wheel    86 26 Jan  2022 valet
brew config
HOMEBREW_VERSION: 4.0.9-2-gaa36104
ORIGIN: https://github.com/Homebrew/brew
HEAD: aa36104e0f9785fd7d6e96bf312111cede3e94d0
Last commit: 4 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b2439adf3b60c0e598a8a2f82b8574b8849ccecb
Core tap last commit: 7 weeks ago
Core tap branch: master
Core tap JSON: 20 Mar 20:30 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.1.6 build 1316
Git: 2.32.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5.1-arm64
CLT: 13.4.0.0.1.1651278267
Xcode: N/A
Rosetta 2: false
brew services list
Name        Status User      File
dnsmasq     none            root      
mariadb     started         chrisware ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
meilisearch error  256      root      ~/Library/LaunchAgents/homebrew.mxcl.meilisearch.plist
nginx       none            root      
php         none            root      
php@5.6     none                      
php@7.0     none                      
php@7.1     none            root      
php@7.2     none            root      
php@7.4     none            root      
php@8.0     none            root      
php@8.1     none            root      
redis       started         chrisware ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
brew list --formula --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
dnsmasq 2.86 2.86.reinstall
mariadb 10.10.3
nginx 1.23.3
openssl@1.1 1.1.1t
php 8.1.12 8.2.3
php@5.6 5.6.40_6
php@7.0 7.0.33_7
php@7.1 7.1.33_6
php@7.2 7.2.34_6
php@7.4 7.4.33_1
php@8.0 8.0.28
php@8.1 8.1.16
brew outdated
bat
bitwarden-cli
composer
curl
dnsmasq
freetype
glances
glib
gnu-sed
highway
htop
imagemagick
imath
jpeg-xl
jpegoptim
libomp
mariadb
meilisearch
mkcert
msgpack
ncurses
node
nspr
nss
openexr
openssl@3
shivammathur/php/php
shivammathur/php/php@8.1
python@3.10
redis
rust
six
sqlite
stripe/stripe-cli/stripe
shivammathur/extensions/xdebug@8.1
xz
phpmon
responsively
sequel-ace
brew tap
homebrew/cask
homebrew/core
homebrew/services
kabel/php-ext
nicoverbruggen/cask
shivammathur/extensions
shivammathur/php
stripe/stripe-cli
php -v
PHP 8.2.3 (cli) (built: Feb 15 2023 00:58:03) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.3, Copyright (c), by Zend Technologies
which -a php
/opt/homebrew/bin/php
php --ini
Configuration File (php.ini) Path: /opt/homebrew/etc/php/8.2
Loaded Configuration File:         /opt/homebrew/etc/php/8.2/php.ini
Scan for additional .ini files in: /opt/homebrew/etc/php/8.2/conf.d
Additional .ini files parsed:      /opt/homebrew/etc/php/8.2/conf.d/20-imagick.ini,
/opt/homebrew/etc/php/8.2/conf.d/20-yaml.ini,
/opt/homebrew/etc/php/8.2/conf.d/error_log.ini,
/opt/homebrew/etc/php/8.2/conf.d/ext-opcache.ini,
/opt/homebrew/etc/php/8.2/conf.d/php-memory-limits.ini
nginx -v
nginx version: nginx/1.23.3
curl --version
curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
php --ri curl
curl

cURL support => enabled
cURL Information => 7.87.0
Age => 10
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => No
HTTPS_PROXY => Yes
MULTI_SSL => Yes
BROTLI => Yes
ALTSVC => Yes
HTTP3 => No
UNICODE => No
ZSTD => Yes
HSTS => Yes
GSASL => No
Protocols => dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtmp, rtmpe, rtmps, rtmpt, rtmpte, rtmpts, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => aarch64-apple-darwin21.6.0
SSL Version => (SecureTransport) OpenSSL/1.1.1t
ZLib Version => 1.2.11
libSSH Version => libssh2/1.10.0

Directive => Local Value => Master Value
curl.cainfo => no value => no value
/opt/homebrew/bin/ngrok version
sudo: /opt/homebrew/bin/ngrok: command not found
ls -al ~/.ngrok2
ls: /Users/chrisware/.ngrok2: No such file or directory
brew info nginx
==> nginx: stable 1.23.3 (bottled), HEAD
HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
https://nginx.org/
/opt/homebrew/Cellar/nginx/1.23.3 (26 files, 2.2MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-02-15 at 12:40:44
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/nginx.rb
License: BSD-2-Clause
==> Dependencies
Required: openssl@1.1, pcre2
==> Options
--HEAD
    Install HEAD version
==> Caveats
Docroot is: /opt/homebrew/var/www

The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /opt/homebrew/etc/nginx/servers/.

To start nginx now and restart at login:
  brew services start nginx
==> Analytics
install: 4,380 (30 days), 86,587 (90 days), 427,469 (365 days)
install-on-request: 4,365 (30 days), 86,457 (90 days), 426,747 (365 days)
build-error: 0 (30 days)
brew info php
==> php: stable 8.2.4 (bottled), HEAD
General-purpose scripting language
https://www.php.net/
/opt/homebrew/Cellar/php/8.1.12 (193 files, 33.8MB)
  Built from source
/opt/homebrew/Cellar/php/8.2.3 (519 files, 83.3MB) *
  Poured from bottle on 2023-02-15 at 12:37:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/php.rb
License: PHP-3.01
==> Dependencies
Build: httpd, pkg-config
Required: apr, apr-util, argon2, aspell, autoconf, curl, freetds, gd, gettext, gmp, icu4c, krb5, libpq, libsodium, libzip, oniguruma, openldap, openssl@1.1, pcre2, sqlite, tidy-html5, unixodbc
==> Options
--HEAD
    Install HEAD version
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

    
        SetHandler application/x-httpd-php
    

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /opt/homebrew/etc/php/8.2/

To start php now and restart at login:
  brew services start php
==> Analytics
install: 16,191 (30 days), 311,161 (90 days), 1,416,631 (365 days)
install-on-request: 14,342 (30 days), 275,954 (90 days), 1,232,465 (365 days)
build-error: 0 (30 days)
brew info openssl
==> openssl@3: stable 3.1.0 (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/opt/homebrew/Cellar/openssl@3/3.0.8 (6,480 files, 28.1MB)
  Poured from bottle using the formulae.brew.sh API on 2023-02-15 at 12:39:23
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openssl@3.rb
License: Apache-2.0
==> Dependencies
Required: ca-certificates
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /opt/homebrew/etc/openssl@3/certs

and run
  /opt/homebrew/opt/openssl@3/bin/c_rehash

openssl@3 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
==> Analytics
install: 44,325 (30 days), 801,882 (90 days), 2,342,624 (365 days)
install-on-request: 11,509 (30 days), 208,136 (90 days), 1,271,038 (365 days)
build-error: 594 (30 days)
openssl version -a
OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)
built on: Tue Feb  7 13:43:33 2023 UTC
platform: darwin64-arm64-cc
options:  bn(64,64)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
OPENSSLDIR: "/opt/homebrew/etc/openssl@3"
ENGINESDIR: "/opt/homebrew/Cellar/openssl@3/3.0.8/lib/engines-3"
MODULESDIR: "/opt/homebrew/Cellar/openssl@3/3.0.8/lib/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_armcap=0x7d
openssl ciphers
TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:RSA-PSK-AES256-GCM-SHA384:DHE-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:DHE-PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305:AES256-GCM-SHA384:PSK-AES256-GCM-SHA384:PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256:DHE-PSK-AES128-GCM-SHA256:AES128-GCM-SHA256:PSK-AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:ECDHE-PSK-AES256-CBC-SHA384:ECDHE-PSK-AES256-CBC-SHA:SRP-RSA-AES-256-CBC-SHA:SRP-AES-256-CBC-SHA:RSA-PSK-AES256-CBC-SHA384:DHE-PSK-AES256-CBC-SHA384:RSA-PSK-AES256-CBC-SHA:DHE-PSK-AES256-CBC-SHA:AES256-SHA:PSK-AES256-CBC-SHA384:PSK-AES256-CBC-SHA:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-CBC-SHA:SRP-RSA-AES-128-CBC-SHA:SRP-AES-128-CBC-SHA:RSA-PSK-AES128-CBC-SHA256:DHE-PSK-AES128-CBC-SHA256:RSA-PSK-AES128-CBC-SHA:DHE-PSK-AES128-CBC-SHA:AES128-SHA:PSK-AES128-CBC-SHA256:PSK-AES128-CBC-SHA
sudo nginx -t
nginx: the configuration file /opt/homebrew/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /opt/homebrew/etc/nginx/nginx.conf test is successful
which -a php-fpm
/opt/homebrew/sbin/php-fpm
/opt/homebrew/opt/php/sbin/php-fpm -v
PHP 8.2.3 (fpm-fcgi) (built: Feb 15 2023 00:58:04)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.3, Copyright (c), by Zend Technologies
sudo /opt/homebrew/opt/php/sbin/php-fpm -y /opt/homebrew/etc/php/8.2/php-fpm.conf --test
[20-Mar-2023 20:30:31] NOTICE: configuration file /opt/homebrew/etc/php/8.2/php-fpm.conf test is successful
ls -al ~/Library/LaunchAgents | grep homebrew
-rw-r--r--   1 chrisware  staff   730 13 Mar 10:26 homebrew.mxcl.mariadb.plist
-rw-r--r--   1 chrisware  staff   715  1 Nov 20:52 homebrew.mxcl.meilisearch.plist
-rw-r--r--   1 chrisware  staff   729  9 Jun  2022 homebrew.mxcl.meilisearch@0.24.0.plist
-rw-r--r--   1 chrisware  staff   880 13 Mar 10:26 homebrew.mxcl.redis.plist
ls -al /Library/LaunchAgents | grep homebrew

ls -al /Library/LaunchDaemons | grep homebrew
-rw-r--r--   1 root  admin   602 20 Mar 19:59 homebrew.mxcl.dnsmasq.plist
-rw-r--r--   1 root  admin   715  5 Jul  2022 homebrew.mxcl.meilisearch.plist
-rw-r--r--   1 root  admin   685 20 Mar 20:25 homebrew.mxcl.nginx.plist
-rw-r--r--   1 root  admin   781 20 Mar 19:59 homebrew.mxcl.php.plist
-rw-r--r--   1 root  admin   789 20 Mar 20:02 homebrew.mxcl.php@7.1.plist
-rw-r--r--   1 root  admin   789 20 Mar 20:20 homebrew.mxcl.php@7.2.plist
-rw-r--r--   1 root  admin   789 20 Mar 19:58 homebrew.mxcl.php@7.4.plist
-rw-r--r--   1 root  admin   789 20 Mar 19:58 homebrew.mxcl.php@8.0.plist
-rw-r--r--   1 root  admin   789 20 Mar 19:59 homebrew.mxcl.php@8.1.plist
ls -al /Library/LaunchDaemons | grep "com.laravel.valet."

ls -aln /etc/resolv.conf
lrwxr-xr-x  1 0  0  22 11 Aug  2022 /etc/resolv.conf -> ../var/run/resolv.conf
cat /etc/resolv.conf
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
#   scutil --dns
#
# SEE ALSO
#   dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
search home
nameserver fe80::c6e5:32ff:fe26:cbd5%en0
nameserver 192.168.1.254
ifconfig lo0
lo0: flags=8049 mtu 16384
    options=1203
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201
sh -c 'echo "------\n/opt/homebrew/etc/nginx/valet/valet.conf\n---\n"; cat /opt/homebrew/etc/nginx/valet/valet.conf | grep -n "# valet loopback"; echo "\n------\n"'
------
/opt/homebrew/etc/nginx/valet/valet.conf
---

3:    #listen VALET_LOOPBACK:80; # valet loopback

------
sh -c 'for file in ~/.config/valet/dnsmasq.d/*; do echo "------\n~/.config/valet/dnsmasq.d/$(basename $file)\n---\n"; cat $file; echo "\n------\n"; done'
------
~/.config/valet/dnsmasq.d/tld-test.conf
---

address=/.test/127.0.0.1
listen-address=127.0.0.1

_SITE DETAILS REMOVED FOR SECURITY_            
naabster commented 1 year ago

I found the valet link --isolate --secure foobarcommand does indeed link the correct domain (foobar.test), but the PHP version in .valetrc is ignored.

The --isolate switch does read the .valetrc file, but use it only for the isolation of the folders name, not the custom link "foobar" provided

mattstauffer commented 1 year ago

I think we have two separate issues. @naabster would you mind spinning up a separate issue for that?

mattstauffer commented 1 year ago

I made a tiny bit of progress but then had to leave earlier than expected. Here's what I did:

cd /tmp
mkdir linking-as-not-foobar
cd linking-as-not-foobar
echo "php=php@8.0" > .valetrc
valet link foobar --isolate

and here's my error:

image

So as we can see, we get this error when trying to isolate the directory:

  at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/Valet/Site.php:182
 Valet\Site->getSiteUrl() at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/Valet/PhpFpm.php:171
 Valet\PhpFpm->isolateDirectory() at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/includes/facades.php:22

It's passing in the directory instead of the isolated short name. Hopefully that's an easy fix when I have a bit more time!

mcaskill commented 1 year ago

I'm new to Valet and I stumbled upon this exact issue. I organize my projects something like this:

~/Projects/
└── <domain>
    └── <subdomain>      # 'www' for root
        ├── _codebase/   # vcs repository
        │   └── public/  # document root
        └── _resources/  # files, presentation, artifacts, etc.

This incidentally results in the same issue:

~/Projects/example.com/www/_codebase
$ valet link example --secure --isolate
A [example] symbolic link has been created in [~/.config/valet/Sites/example].
Restarting nginx...
The [example.test] site has been secured with a fresh TLS certificate.
Found '_codebase/.valetrc' or '_codebase/.valetphprc' specifying version: php@8.1

In Site.php line 182:

  The [_codebase] site could not be found in Valet's site list.

link [--secure] [--isolate] [--] [<name>]

It took me a while to figure it out—given the many different ways Valet resolves sites—but the issue stems from the isolate command defaulting to the current directory's name instead of the full path like the secure command does.

A simple solution to this: provide the --site= option to the isolate sub-command with the given link name:

 if (Site::phpRcVersion($name)) {
-    $this->runCommand('isolate');
+    $this->runCommand('isolate --site="'.$name.'"');
 } else {

Unfortunately, this does not work since mnapoli/silly v1.8.1 which introduced an untested change to how sub-commands are handled as a consequence of a easily confusing error message from symfony/console.

See mnapoli/silly#69 for further details, mnapoli/silly#70 for the fix of the dependency, and laravel/valet#1428 for the fix of this issue.

driesvints commented 1 year ago

Will be in today's release. Thanks all