[Feature] Integrate PsySH in dev mode #10094

Closed
vicb opened this Issue Jan 21, 2014 · 20 comments

Projects

None yet
@vicb

It would be great to be able to debug exception in dev mode with PsySH.

I've not yet look at the details and how hard this could be but using a REPL to debug misbehaved code is something really useful - This is something avaiable in the Python Pylons framework.

/cc @bobthecow

@sstok

👍

@lyrixx
Symfony member

There is this one too: https://github.com/d11wtq/boris

@hason

👍
We can use websocket as in experimental implementation for the Tracy nette/tracy@59d9c81 - see in action http://vimeo.com/72138480

@lyrixx PsySH also works on windows

@vicb

@hason The video shows exactly what I was thinking about, would be great to investigate more.

@hacfi

@vicb Great idea..really cool stuff :)

@benglass

👍 great idea

@lyrixx
Symfony member

We are on it ;)

@breerly

huge ass 👍

@breerly

Not completely positive, but isn't PHPDGB going to be included in PHP 5.6? Perhaps we should look in that direction...

@lmammino

seems cool 👌

@hason

An another example of using websockets https://github.com/Hywan/PHP-live-execution

@lyrixx
Symfony member

So I have tried lot of things:

  • Open a debugger (REPL) when an error occurs. It is nice, but does not work with exceptions and fatal error => not so useful
  • Add a kind on breakpoint function: When the user call it, the execution is stopped. Then it is possible to view / edit current scope. But this is not easy to setup because it need 2 tabs or 2 browser. I also tried to inline the form (text-area) in the first page, but it is not so easy because of different buffers of php / nginx / ...
@hason hason referenced this issue in filp/whoops Feb 25, 2014
Closed

REPL #42

@varas

I use both PsySh and Symfony. PsySH is based upon Symfony/Command and i usually get conflicts when the component version that uses is different than the one on PsySh. It would be great to integrate both and solve this.

Even more funnier if a repl is open as a debug option. @lyrixx you could capture exceptions changing the handler, and even some errors. I made a proof of concept here https://github.com/varas/errepl

@bobthecow

@varas If you add PsySH to your symfony project's composer.json then do composer update, it'll figure out a version of symfony and psysh that work together and you won't have any conflicts :)

@lyrixx
Symfony member

Sorry, I did not take time to comment this topic.
We have tried to add a REPL when an exception is found but it's not so nice:

  • PHP context is available only when a PHP error occur (not an exception)
  • the worflow to maintain a REPL while PHP is dying is hard to understand and very hard to maintain because there is lot of edge case.
  • acutally, the REPL is not so useful when an exception happen.
@varas

Thanks @bobthecow i'm used to include require-dev's from global, but that seems to be more convenient.

@Markcial

ping! any code samples, updates or a project started on this, should i work from scratch?

@lyrixx
Symfony member

All my code is a very quick & dirty code.

But you can have a look to: https://github.com/dpb587/ti-debug which is a good start.

@fabpot
Symfony member

Looks like it's not that easy. If anyone can create a PR, that would be great; closing this issue in the meantime.

@fabpot fabpot closed this Oct 5, 2015
@aar0nr

If you're looking for a simple CLI for the container, kernel, and parameters, check out https://github.com/theofidry/PsyshBundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment