laravel-tinker icon indicating copy to clipboard operation
laravel-tinker copied to clipboard

[Feature]: allow using pure PsySH

Open igorsantos07 opened this issue 1 year ago • 2 comments

Related problem

Tinker is a superset of PsySH, as I guess you're aware haha

It would be awesome to allow any psysh instance to be run from the IDE, effectively supporting any of those frameworks which integrate PsySH.

My ideal solution

To my naive understanding, you need to find the REPL executable and pass the user input to it, right? Since Tinker is a superset of PsySH, it would work the exact same way - except the user would be allowed to configure if they want to use Tinker, some other binary from vendor/bin, or the default psysh executable.

In fact, psysh can be run directly from composer - composer psysh works fine if psy/psysh is installed in the project.

Concidered alternatives

I tried checking the plugin config, but it looks like it gets lost if it can't find the Laravel file structure.

Additional context

No response

Intentions

  • [ ] I'm open to build this myself and PR it

igorsantos07 avatar Feb 12 '24 05:02 igorsantos07

Yeah, I'm aware. I could split off a version which does not load in all the Tinker stuff - I'm not really using 'php artisan tinker' either way, just adding the things that command adds to the Psysh.

It's a possibility - however, what would it then be different from just running a php script? :P

Roboroads avatar Feb 16 '24 00:02 Roboroads

Possibly related.. Psysh and dependencies versions breaking things for me working on older package and php versions

I'm using laravel-tinker on some of our newer projects that are running Laravel 9 and PHP 8.1 and all it good (thanks for great plugin).

I do have a problem trying to use the plugin with the majority of our older (and very complex) projects that are stuck on PHP-7.0 and Laravel 5.5. I'm not a phpstrom plugin developer but looking at the entry point for PHP, the tinker_run.php script, I see my problems being driven from a few dependency/version related issues.

  • [$id, $token] = $token; # list unpacking only supported in php-7.1+ ( fix with traditional list($id,$token) = $token )
  • Psy\Configuration signature changed - between v0.9.12 and v.0.11.13

It would be great if

  • the newest plugin's tinker_run.php was dependency aware and adapted accordingly ( something like if(PHP_VERSION_ID < 71000) { )

For anybody else having these issues (on php-7.0) the only solution I found is the travel back in time and manually force things

  • PHPStorm-2020.2.4 - https://download.jetbrains.com/webide/PhpStorm-2020.2.4.dmg (required for dependency with 1.2.1 plugin of laravel-tinker)
  • Manually install PHPStorm plugin of laravel-tinker plugin at v 1.2.1 - https://github.com/Roboroads/laravel-tinker/releases/tag/v1.2.1 (not v 1.3.0 as it breaks due to [$id, $token] = $token; in php7.0).

bgdevlab avatar Apr 12 '24 05:04 bgdevlab

This issue has been automatically marked as stale because it has not had recent activity. This means this issue is resolved or nobody else has had this issue or feature request. It will be closed if no further activity occurs within 30 days, so if this is still relevant, please let us know!

stale[bot] avatar Jun 12 '24 05:06 stale[bot]

stale-proof comment

igorsantos07 avatar Jun 12 '24 19:06 igorsantos07

@igorsantos07 How's the 2.7.3 update for you?

Roboroads avatar Jun 22 '24 21:06 Roboroads