Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valet restart #1

Open
piperone opened this issue Jul 7, 2020 · 6 comments
Open

Valet restart #1

piperone opened this issue Jul 7, 2020 · 6 comments

Comments

@piperone
Copy link

piperone commented Jul 7, 2020

Thanks for this really nifty little tool! I found it through the Laravel newsletter.

I have a bit of an issue. I use Laravel Valet for local development. I have Xdebug installed (the ext-xdebug.ini-file inside conf.d, etc) and it works fine. However, if I disable xdebug using the toggler and then re-enable it, xdebug appears not to be enabled. Even checking "--all" for which services to restart, xdebug is not active again until I run valet restart. I don't know why this is the case.

One possible solution to this, would be adding an option for a "custom command" to run after toggling (instead of the brew services commands). Just a thought.

Thanks again.

@deligoez
Copy link
Owner

deligoez commented Jul 7, 2020

Hi, I'm glad you like xDebugToggler.

This is a kind of a known issue. Sometimes even running valet restart is not enough, PhpStorm also needs to be restarted.

For the next version; running commands with sudo and/or custom commands will be the first priority.

Thanks for noticing.

@deligoez deligoez closed this as completed Jul 7, 2020
@incon
Copy link

incon commented Jul 10, 2020

A restart valet option would be nice.

@jonnywilliamson
Copy link

Hello,

I've just discovered this wonderful little tool and this exact issue is cropping up!

Valet requires that the php services is run by root and not the user, so when this tool tries to restart the brew service it doesn't use sudo or valet restart

Really hoping at some stage this might be incorporated!

Thank you very much @deligoez

@jonnywilliamson
Copy link

jonnywilliamson commented Dec 14, 2020

https://developer.apple.com/forums/thread/91350
https://developer.apple.com/forums/thread/99151

Of course, having looked into this a little, it appears nothing will be easy! 🙄

@deligoez deligoez reopened this Dec 15, 2020
@deligoez
Copy link
Owner

Hi Everybody,

Thanks for your suggestions.

Before diving into running sudo commands from swift. I think I found a quick way to restart valet.

valet has a trust command which makes valet commands run without root user password.

I'll start to implement this today.

@droath
Copy link

droath commented Mar 29, 2022

Is this project maintained anymore? Really would like it to include valet restart. In the meantime you can just add this to your ~/.bashrc or ~/.zshrc file. Then you'll be able to turn on/off xdebug from the terminal

# Enabled/Disable valet php xdebug extension.
function valet:xdebug() {
  STATE="${1:?Missing argument, pass either on|off.}"
  PHP_EXT_XDEBUG="/usr/local/etc/php/7.4/conf.d/ext-xdebug.ini"
  
  if [[ $STATE == "on" && -f "$PHP_EXT_XDEBUG.disabled" ]]; then
    mv "$PHP_EXT_XDEBUG.disabled" $PHP_EXT_XDEBUG
  fi 
  
  if [[ $STATE == "off" && -f $PHP_EXT_XDEBUG ]]; then
    mv $PHP_EXT_XDEBUG "$PHP_EXT_XDEBUG.disabled" 
  fi
  
  valet restart php
}

Then re-source using source ~/.zshrc , now when you type valet:xdebug on|off it should enable|disable xdebug and then do a valet restart php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants